portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r919260 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/ components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/ components/jetspeed-portal-...
Date Fri, 05 Mar 2010 01:25:15 GMT
Author: rwatler
Date: Fri Mar  5 01:25:15 2010
New Revision: 919260

URL: http://svn.apache.org/viewvc?rev=919260&view=rev
Log:
JS2-1118: Add PSML access to Portal Site Menus

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuElementImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuOptionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuSeparatorImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SiteView.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/MenuElement.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuElementImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuElementImpl.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuElementImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuElementImpl.java
Fri Mar  5 01:25:15 2010
@@ -18,10 +18,15 @@
 
 import java.util.Locale;
 
+import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.page.Link;
+import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.portalsite.Menu;
 import org.apache.jetspeed.portalsite.MenuElement;
+import org.apache.jetspeed.portalsite.view.SiteView;
 
 /**
  * This abstract class implements common features of portal-site
@@ -33,6 +38,11 @@
 public abstract class MenuElementImpl implements MenuElement, Cloneable
 {
     /**
+     * view - site view this proxy is part of
+     */
+    private SiteView view;
+
+    /**
      * parentMenu - parent menu implementation
      */
     private MenuImpl parent;
@@ -58,22 +68,25 @@
     /**
      * MenuElementImpl - constructor
      *
+     * @param view site view used to construct menu element
      * @param parent containing menu implementation
      */
-    protected MenuElementImpl(MenuImpl parent)
+    protected MenuElementImpl(SiteView view, MenuImpl parent)
     {
+        this.view = view;
         this.parent = parent;
     }
 
     /**
      * MenuElementImpl - node proxy constructor
      *
+     * @param view site view used to construct menu element
      * @param parent containing menu implementation
      * @param node menu element node proxy
      */
-    protected MenuElementImpl(MenuImpl parent, Node node)
+    protected MenuElementImpl(SiteView view, MenuImpl parent, Node node)
     {
-        this(parent);
+        this(view, parent);
         this.node = node;
     }
 
@@ -124,6 +137,16 @@
      *         SEPARATOR_ELEMENT_TYPE
      */
     public abstract String getElementType();
+    
+    /**
+     * getView - return site view for this menu element
+     *
+     * @return site view
+     */
+    protected SiteView getView()
+    {
+        return view;
+    }
 
     /**
      * getParentMenu - get menu that contains menu element 
@@ -275,7 +298,7 @@
      *
      * @return node proxy
      */
-    protected Node getNode()
+    public Node getNode()
     {
         return node;
     } 
@@ -289,4 +312,53 @@
     {
         this.node = node;
     } 
+    
+    /**
+     * isEditable - get editable access flag for menu option
+     *
+     * @return editable flag
+     */
+    public boolean isEditable()
+    {
+        try
+        {
+            getNode().checkAccess(JetspeedActions.EDIT);
+            return true;
+        }
+        catch (SecurityException se)
+        {
+            return false;
+        }
+    }
+
+    /**
+     * getManagedNode - get underlying managed concrete Node
+     *                  associated with menu element; note that the
+     *                  node returned is not necessarily deterministic
+     *                  if the mapping of profiled folders, pages,
+     *                  and links is not mapped 1:1
+     *
+     * @return concrete folder, page, or link node
+     */
+    public Node getManagedNode()
+    {
+        SiteView view = getView();
+        if (view != null)
+        {
+            Node node = getNode();
+            if (node instanceof Page)
+            {
+                return view.getManagedPage((Page)node);
+            }
+            else if (node instanceof Link)
+            {
+                return view.getManagedLink((Link)node);
+            }
+            else if (node instanceof Folder)
+            {
+                return view.getManagedFolder((Folder)node);
+            }
+        }
+        return null;
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
Fri Mar  5 01:25:15 2010
@@ -75,6 +75,19 @@
     /**
      * MenuImpl - request/session context dependent constructor
      *
+     * @param view site view used to construct menu
+     * @param definition menu definition
+     * @param context request context
+     * @param menus related menu definition names set
+     */
+    public MenuImpl(MenuDefinition definition, PortalSiteRequestContextImpl context, Set
menus)
+    {
+        this((MenuImpl)null, definition, context, menus);
+    }
+
+    /**
+     * MenuImpl - request/session context dependent constructor
+     *
      * @param parent containing menu implementation
      * @param definition menu definition
      * @param context request context
@@ -82,11 +95,22 @@
      */
     public MenuImpl(MenuImpl parent, MenuDefinition definition, PortalSiteRequestContextImpl
context, Set menus)
     {
-        super(parent);
-        this.definition = definition;
+        this(((PortalSiteSessionContextImpl)context.getSessionContext()).getSiteView(), parent,
definition, context, menus);
+    }
 
-        // get site view from context
-        SiteView view = ((PortalSiteSessionContextImpl)context.getSessionContext()).getSiteView();
+    /**
+     * MenuImpl - request/session context dependent constructor
+     *
+     * @param view site view used to construct menu
+     * @param parent containing menu implementation
+     * @param definition menu definition
+     * @param context request context
+     * @param menus related menu definition names set
+     */
+    protected MenuImpl(SiteView view, MenuImpl parent, MenuDefinition definition, PortalSiteRequestContextImpl
context, Set menus)
+    {
+        super(view, parent);
+        this.definition = definition;
         if (view != null)
         {
             // define menu node for titles and metadata if options
@@ -170,7 +194,7 @@
                 }
 
                 // menu defined only with menu definition options
-                this.elements = constructMenuElements(context, view, options, overrideOptionProxies,
definition.getDepth(), definition.isPaths(), definition.isRegexp(), definition.getProfile(),
definition.getOrder());
+                this.elements = constructMenuElements(view, context, options, overrideOptionProxies,
definition.getDepth(), definition.isPaths(), definition.isRegexp(), definition.getProfile(),
definition.getOrder());
             }
             else
             {
@@ -214,7 +238,7 @@
                         {
                             order = definition.getOrder();
                         }
-                        List optionsAndMenus = constructMenuElements(context, view, optionDefinition.getOptions(),
null, optionDefinition.getDepth(), optionDefinition.isPaths(), optionDefinition.isRegexp(),
locatorName, order);
+                        List optionsAndMenus = constructMenuElements(view, context, optionDefinition.getOptions(),
null, optionDefinition.getDepth(), optionDefinition.isPaths(), optionDefinition.isRegexp(),
locatorName, order);
 
                         // append option and menu elements to current separator
                         // elements list
@@ -256,7 +280,7 @@
                         // construct new separator and reset separator
                         // and separator option/menu elements list
                         MenuSeparatorDefinition separatorDefinition = (MenuSeparatorDefinition)menuElement;
-                        separator = new MenuSeparatorImpl(this, separatorDefinition);
+                        separator = new MenuSeparatorImpl(view, this, separatorDefinition);
                         if (separatedElements != null)
                         {
                             separatedElements.clear();
@@ -266,7 +290,7 @@
                     {
                         // construct nested menu element from definition
                         MenuDefinition menuDefinition = (MenuDefinition)menuElement;
-                        MenuImpl nestedMenu = new MenuImpl(this, menuDefinition, context,
menus);
+                        MenuImpl nestedMenu = new MenuImpl(view, this, menuDefinition, context,
menus);
 
                         // append menu element to current separated elements list
                         if (separatedElements == null)
@@ -464,18 +488,6 @@
     }
 
     /**
-     * MenuImpl - request/session context dependent constructor
-     *
-     * @param definition menu definition
-     * @param context request context
-     * @param menus related menu definition names set
-     */
-    public MenuImpl(MenuDefinition definition, PortalSiteRequestContextImpl context, Set
menus)
-    {
-        this(null, definition, context, menus);
-    }
-
-    /**
      * appendMenuElement - append to ordered list of unique menu
      *                     option/menu elements
      * 
@@ -550,7 +562,7 @@
      * @param locatorName profile locator name
      * @param order ordering patterns list
      */
-    private List constructMenuElements(PortalSiteRequestContextImpl context, SiteView view,
String options, List overrideElementProxies, int depth, boolean paths, boolean regexp, String
locatorName, String order)
+    private List constructMenuElements(SiteView view, PortalSiteRequestContextImpl context,
String options, List overrideElementProxies, int depth, boolean paths, boolean regexp, String
locatorName, String order)
     {
         if (options != null)
         {
@@ -738,7 +750,7 @@
                 {
                     // construct menu definition and associated menu
                     MenuDefinition nestedMenuDefinition = new DefaultMenuDefinition(elementProxy.getUrl(),
depth - 1, locatorName);
-                    menuElement = new MenuImpl(this, nestedMenuDefinition, context, null);
+                    menuElement = new MenuImpl(view, this, nestedMenuDefinition, context,
null);
                 }
                 else
                 {
@@ -747,7 +759,7 @@
                     {
                         defaultMenuOptionsDefinition = new DefaultMenuOptionsDefinition(options,
depth, paths, regexp, locatorName, order);
                     }
-                    menuElement = new MenuOptionImpl(this, elementProxy, defaultMenuOptionsDefinition);
+                    menuElement = new MenuOptionImpl(view, this, elementProxy, defaultMenuOptionsDefinition);
                 }
 
                 // replace element proxy with menu element

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuOptionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuOptionImpl.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuOptionImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuOptionImpl.java
Fri Mar  5 01:25:15 2010
@@ -25,6 +25,7 @@
 import org.apache.jetspeed.page.document.NodeNotFoundException;
 import org.apache.jetspeed.portalsite.MenuOption;
 import org.apache.jetspeed.portalsite.PortalSiteRequestContext;
+import org.apache.jetspeed.portalsite.view.SiteView;
 
 /**
  * This class implements the portal-site menu option
@@ -43,13 +44,14 @@
     /**
      * MenuOptionImpl - constructor
      *
+     * @param view site view used to construct menu option
      * @param parent containing menu implementation
      * @param node menu option node proxy
      * @param definition menu option definition
      */
-    public MenuOptionImpl(MenuImpl parent, Node node, MenuOptionsDefinition definition)
+    public MenuOptionImpl(SiteView view, MenuImpl parent, Node node, MenuOptionsDefinition
definition)
     {
-        super(parent, node);
+        super(view, parent, node);
         this.definition = definition;
     }
 

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuSeparatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuSeparatorImpl.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuSeparatorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/MenuSeparatorImpl.java
Fri Mar  5 01:25:15 2010
@@ -21,6 +21,7 @@
 import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.portalsite.MenuSeparator;
+import org.apache.jetspeed.portalsite.view.SiteView;
 
 /**
  * This class implements the portal-site menu separator
@@ -39,12 +40,13 @@
     /**
      * MenuSeparatorImpl - constructor
      *
+     * @param view site view used to construct menu option
      * @param parent containing menu implementation
      * @param definition menu separator definition
      */
-    public MenuSeparatorImpl(MenuImpl parent, MenuSeparatorDefinition definition)
+    public MenuSeparatorImpl(SiteView view, MenuImpl parent, MenuSeparatorDefinition definition)
     {
-        super(parent);
+        super(view, parent);
         this.definition = definition;
     }
 

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SiteView.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SiteView.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SiteView.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/view/SiteView.java
Fri Mar  5 01:25:15 2010
@@ -33,6 +33,7 @@
 import org.apache.jetspeed.om.page.PageTemplate;
 import org.apache.jetspeed.om.page.proxy.DynamicPageProxy;
 import org.apache.jetspeed.om.page.proxy.FragmentDefinitionProxy;
+import org.apache.jetspeed.om.page.proxy.LinkProxy;
 import org.apache.jetspeed.om.page.proxy.PageProxy;
 import org.apache.jetspeed.om.page.proxy.PageTemplateProxy;
 import org.apache.jetspeed.page.PageManager;
@@ -1349,6 +1350,38 @@
     }
 
     /**
+     * getManagedLink - get concrete link instance from link proxy;
+     *                  implemented here to hide view proxy manipulation
+     *                  from more general portal site implementation
+     *  
+     * @param link link proxy
+     * @return managed link
+     */
+    public Link getManagedLink(Link link)
+    {
+        // access link proxy from specified page and
+        // return associated delegate managed link
+        LinkProxy linkProxy = (LinkProxy)NodeProxy.getNodeProxy(link);
+        return ((linkProxy != null) ? linkProxy.getLink() : null);
+    }
+
+    /**
+     * getManagedFolder - get concrete folder instance from folder proxy;
+     *                    implemented here to hide view proxy manipulation
+     *                    from more general portal site implementation
+     *  
+     * @param folder folder proxy
+     * @return managed folder
+     */
+    public Folder getManagedFolder(Folder folder)
+    {
+        // access folder proxy from specified folder and
+        // return associated delegate managed folder
+        FolderProxy folderProxy = (FolderProxy)NodeProxy.getNodeProxy(folder);
+        return ((folderProxy != null) ? folderProxy.getDefaultFolder() : null);
+    }
+
+    /**
      * getManagedPageTemplate - get concrete page template instance from
      *                          page template proxy; implemented here to
      *                          hide view proxy manipulation from more

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
Fri Mar  5 01:25:15 2010
@@ -739,6 +739,10 @@
                 assertTrue(element instanceof Menu);
                 assertEquals("/folder0", ((Menu)element).getUrl());
                 assertTrue(((Menu)element).getParentMenu() == topMenu);
+                assertTrue(element.getNode() instanceof Folder);
+                assertEquals("/folder0", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Folder);
+                assertEquals("/folder0", element.getManagedNode().getPath());
                 assertFalse(((Menu)element).isEmpty());
                 List elements = ((Menu)element).getElements();
                 assertNotNull(elements);
@@ -752,6 +756,10 @@
                 assertTrue(element instanceof Menu);
                 assertEquals("/folder1", ((Menu)element).getUrl());
                 assertTrue(((Menu)element).getParentMenu() == topMenu);
+                assertTrue(element.getNode() instanceof Folder);
+                assertEquals("/folder1", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Folder);
+                assertEquals("/_user/user/folder1", element.getManagedNode().getPath());
                 assertFalse(((Menu)element).isEmpty());
                 List elements = ((Menu)element).getElements();
                 assertNotNull(elements);
@@ -766,16 +774,28 @@
                 assertTrue(element instanceof MenuOption);
                 assertEquals("/page2.psml", ((MenuOption)element).getUrl());
                 assertEquals(MenuOption.PAGE_OPTION_TYPE, ((MenuOption)element).getType());
+                assertTrue(element.getNode() instanceof Page);
+                assertEquals("/page2.psml", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Page);
+                assertEquals("/_user/user/_mediatype/html/page2.psml", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page1.psml"))
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals("/page1.psml", ((MenuOption)element).getUrl());
+                assertTrue(element.getNode() instanceof Page);
+                assertEquals("/page1.psml", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Page);
+                assertEquals("/page1.psml", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/page0.psml"))
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals("/page0.psml", ((MenuOption)element).getUrl());
+                assertTrue(element.getNode() instanceof Page);
+                assertEquals("/page0.psml", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Page);
+                assertEquals("/page0.psml", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/link1.link"))
             {
@@ -783,6 +803,10 @@
                 assertEquals("http://link1", ((MenuOption)element).getUrl());
                 assertEquals("top", ((MenuOption)element).getTarget());
                 assertEquals(MenuOption.LINK_OPTION_TYPE, ((MenuOption)element).getType());
+                assertTrue(element.getNode() instanceof Link);
+                assertEquals("/link1.link", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Link);
+                assertEquals("/link1.link", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/link0.link"))
             {
@@ -790,6 +814,10 @@
                 assertEquals("http://link0", ((MenuOption)element).getUrl());
                 assertNull(((MenuOption)element).getTarget());
                 assertEquals("dhtml-pull-down", element.getSkin());
+                assertTrue(element.getNode() instanceof Link);
+                assertEquals("/link0.link", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Link);
+                assertEquals("/_group/group/link0.link", element.getManagedNode().getPath());
             }
             else
             {
@@ -961,11 +989,19 @@
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals(MenuOption.FOLDER_OPTION_TYPE, ((MenuOption)element).getType());
+                assertTrue(element.getNode() instanceof Folder);
+                assertEquals("/folder0", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Folder);
+                assertEquals("/folder0", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("group folder1"))
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals(MenuOption.FOLDER_OPTION_TYPE, ((MenuOption)element).getType());
+                assertTrue(element.getNode() instanceof Folder);
+                assertEquals("/folder1", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Folder);
+                assertEquals("/_user/user/folder1", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.SEPARATOR_ELEMENT_TYPE)
&&
                      (element instanceof MenuSeparator) &&
@@ -976,12 +1012,20 @@
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals(MenuOption.LINK_OPTION_TYPE, ((MenuOption)element).getType());
+                assertTrue(element.getNode() instanceof Link);
+                assertEquals("/link1.link", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Link);
+                assertEquals("/link1.link", element.getManagedNode().getPath());
             }
             else if (element.getElementType().equals(MenuElement.OPTION_ELEMENT_TYPE) &&
element.getTitle().equals("/link0.link"))
             {
                 assertTrue(element instanceof MenuOption);
                 assertEquals(MenuOption.LINK_OPTION_TYPE, ((MenuOption)element).getType());
                 assertEquals("left-navigations", element.getSkin());
+                assertTrue(element.getNode() instanceof Link);
+                assertEquals("/link0.link", element.getNode().getPath());
+                assertTrue(element.getManagedNode() instanceof Link);
+                assertEquals("/_group/group/link0.link", element.getManagedNode().getPath());
             }
             else
             {

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/MenuElement.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/MenuElement.java?rev=919260&r1=919259&r2=919260&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/MenuElement.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/MenuElement.java
Fri Mar  5 01:25:15 2010
@@ -20,6 +20,7 @@
 import java.util.Locale;
 
 import org.apache.jetspeed.om.portlet.GenericMetadata;
+import org.apache.jetspeed.page.document.Node;
 
 /**
  * This interface describes common features of portal-site
@@ -105,4 +106,29 @@
      * @return skin name
      */
     String getSkin();
+
+    /**
+     * isEditable - get editable access flag for menu option
+     *
+     * @return editable flag
+     */
+    boolean isEditable();
+
+    /**
+     * getNode - get Node proxy from site view associated with element
+     *
+     * @return proxy folder, page, or link node
+     */
+    Node getNode();
+
+    /**
+     * getManagedNode - get underlying managed concrete Node
+     *                  associated with menu element; note that the
+     *                  node returned is not necessarily deterministic
+     *                  if the mapping of profiled folders, pages,
+     *                  and links is not mapped 1:1
+     *
+     * @return concrete folder, page, or link node
+     */
+    Node getManagedNode();
 }



---------------------------------------------------------------------
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