portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r1075433 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site: JetspeedDocument.java MenuTreeNode.java PortalSiteManager.java PortalSiteManagerEdit.java PortalSiteManagerUtil.java
Date Mon, 28 Feb 2011 17:18:51 GMT
Author: vkumar
Date: Mon Feb 28 17:18:50 2011
New Revision: 1075433

URL: http://svn.apache.org/viewvc?rev=1075433&view=rev
Log:
[JS2-1229] Crating empty list of menu, in-case menu is not defined for folder

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/MenuTreeNode.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
  (contents, props changed)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerEdit.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java?rev=1075433&r1=1075432&r2=1075433&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/JetspeedDocument.java
Mon Feb 28 17:18:50 2011
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public class JetspeedDocument implements Serializable
 {
     
-    static final Logger logger = LoggerFactory.getLogger(JetspeedDocument.class);
+    private final Logger logger = LoggerFactory.getLogger(JetspeedDocument.class);
     
     private static final long serialVersionUID = -7429444774638220814L;
     private String name;
@@ -362,11 +362,11 @@ public class JetspeedDocument implements
         this.metaData = new ArrayList<JetspeedDocumentMetaData>();
         if (objectMetaData.getFields() != null)
         {
-            Iterator metaData = objectMetaData.getFields().iterator();
+            Iterator metaDataIterator = objectMetaData.getFields().iterator();
             LocalizedField field;
-            while (metaData.hasNext())
+            while (metaDataIterator.hasNext())
             {
-                field = (LocalizedField) metaData.next();
+                field = (LocalizedField) metaDataIterator.next();
                 this.metaData.add(new JetspeedDocumentMetaData(field.getName(), field.getLocale().toString(),
field.getValue()));
             }
         }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/MenuTreeNode.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/MenuTreeNode.java?rev=1075433&r1=1075432&r2=1075433&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/MenuTreeNode.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/MenuTreeNode.java
Mon Feb 28 17:18:50 2011
@@ -68,60 +68,77 @@ public class MenuTreeNode implements Ser
 
     public MenuDefinition getDefinition()
     {
+      if (type.equals(PortalSiteManager.FOLDER_NODE_TYPE))
+      {
+          getFolderMenuDefinition();
+      }
+      else if (type.equals(PortalSiteManager.PAGE_NODE_TYPE))
+      {
+          getPageMenuDefinition();
+      }
+      return null;
+    }
+
+    private MenuDefinition getPageMenuDefinition()
+    {
         MenuDefinition definition = null;
-        boolean found = true;
+        boolean definitionFound;
         try
         {
-            if (type.equals(PortalSiteManager.FOLDER_NODE_TYPE))
-            {
-                return getMenu(locator.getPageManager().getFolder(path).getMenuDefinitions());
-            }
-            else if (type.equals(PortalSiteManager.PAGE_NODE_TYPE))
-            {
-                return getMenu(locator.getPageManager().getPage(path).getMenuDefinitions());
-            }
+            return getMenu(locator.getPageManager().getPage(path).getMenuDefinitions());
         }
         catch (PageNotFoundException e)
         {
-            found = false;
+            definitionFound = false;
+        }
+        catch (InvalidFolderException e)
+        {
+            definitionFound = false;
+        }
+        catch (NodeException e)
+        {
+            definitionFound = false;
+        }
+        if (!definitionFound)
+        {
+            definition = locator.getPageManager().newPageMenuDefinition();
+        }
+        return definition;
+    }
+
+    private MenuDefinition getFolderMenuDefinition()
+    {
+        MenuDefinition definition = null;
+        boolean definitionFound;
+        try
+        {
+            return getMenu(locator.getPageManager().getFolder(path).getMenuDefinitions());
         }
         catch (FolderNotFoundException e)
         {
-            found = false;
+            definitionFound = false;
         }
         catch (InvalidFolderException e)
         {
-            found = false;
+            definitionFound = false;
         }
         catch (NodeException e)
         {
-            found = false;
+            definitionFound = false;
         }
-        catch (Exception e)
+        if (!definitionFound)
         {
-            found = false;
-        }
-        if (!found)
-        {
-            if (type.equals(PortalSiteManager.PAGE_NODE_TYPE))
-            {
-                definition = locator.getPageManager().newPageMenuDefinition();
-            }
-            else if (type.equals(PortalSiteManager.FOLDER_NODE_TYPE))
-            {
-                definition = locator.getPageManager().newFolderMenuDefinition();
-            }
+            definition = locator.getPageManager().newFolderMenuDefinition();
         }
         return definition;
     }
 
+
     private MenuDefinition getMenu(List menuDefinitions)
     {
-        for (int index = 0; index < menuDefinitions.size(); index++)
-        {
-            MenuDefinition definition = (MenuDefinition) menuDefinitions.get(index);
-            if (definition.getName().equals(name))
-            {
+        for (Object menuDefinition : menuDefinitions) {
+            MenuDefinition definition = (MenuDefinition) menuDefinition;
+            if (definition.getName().equals(name)) {
                 return definition;
             }
         }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java?rev=1075433&r1=1075432&r2=1075433&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
Mon Feb 28 17:18:50 2011
@@ -23,14 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
+import java.util.*;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
@@ -4343,6 +4336,10 @@ public class PortalSiteManager extends A
         {
             Folder folder = getJetspeedFolder(node.getNodePath());
             List menuList = folder.getMenuDefinitions();
+            if(menuList==null)
+            {
+                menuList = new LinkedList();
+            }
             if (action.equals(SAVE_ACTION))
             {
                 menuList.remove(oldElement);

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerEdit.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerEdit.java?rev=1075433&r1=1075432&r2=1075433&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerEdit.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerEdit.java
Mon Feb 28 17:18:50 2011
@@ -40,11 +40,12 @@ import org.slf4j.LoggerFactory;
  */
 public class PortalSiteManagerEdit extends AdminPortletWebPage
 {
-    private Logger log = LoggerFactory.getLogger(PortalSiteManagerEdit.class);
+    private final Logger logger = LoggerFactory.getLogger(PortalSiteManagerEdit.class);
     private String treeRoot;
 
     public PortalSiteManagerEdit()
     {
+        super();
         PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
         treeRoot = request.getPreferences().getValue(PortalSiteManager.TREE_ROOT, "/");
         add(new FeedbackPanel("feedback"));
@@ -59,38 +60,38 @@ public class PortalSiteManagerEdit exten
                 PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
                 try
                 {
-                    if (log.isDebugEnabled())
+                    if (logger.isDebugEnabled())
                     {
-                        log.debug("Setting tree root " + getTreeRoot());
+                        logger.debug("Setting tree root " + getTreeRoot());
                     }
                     request.getPreferences().setValue(PortalSiteManager.TREE_ROOT, getTreeRoot());
                     request.getPreferences().store();
-                    if (log.isDebugEnabled())
+                    if (logger.isDebugEnabled())
                     {
-                        log.debug("Default settiing for portlet saved . ");
+                        logger.debug("Default settiing for portlet saved . ");
                     }
                 }
                 catch (ValidatorException e)
                 {
-                    if (log.isErrorEnabled())
+                    if (logger.isErrorEnabled())
                     {
-                        log.error(e.getMessage());
+                        logger.error(e.getMessage());
                     }
                     error(e.getMessage());
                 }
                 catch (IOException e)
                 {
-                    if (log.isErrorEnabled())
+                    if (logger.isErrorEnabled())
                     {
-                        log.error(e.getMessage());
+                        logger.error(e.getMessage());
                     }
                     error(e.getMessage());
                 }
                 catch (ReadOnlyException e)
                 {
-                    if (log.isErrorEnabled())
+                    if (logger.isErrorEnabled())
                     {
-                        log.error(e.getMessage());
+                        logger.error(e.getMessage());
                     }
                     error(e.getMessage());
                 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java?rev=1075433&r1=1075432&r2=1075433&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/site/PortalSiteManagerUtil.java
Mon Feb 28 17:18:50 2011
@@ -42,12 +42,16 @@ import org.slf4j.LoggerFactory;
  */
 public class PortalSiteManagerUtil
 {
-    
-    static final Logger logger = LoggerFactory.getLogger(PortalSiteManagerUtil.class);
-    
+
+    private static final Logger logger = LoggerFactory.getLogger(PortalSiteManagerUtil.class);
     private static String pathSeprator = System.getProperty("file.separator");
     private static String pageRoot = System.getProperty("java.io.tmpdir");
 
+    private PortalSiteManagerUtil()
+    {
+
+    }
+
     public static String getDownloadLink(String objectName, String userName, String objectType)
throws Exception
     {
         if ("/".equals(objectName))



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message