[gatein-commits] gatein SVN: r2613 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Apr 14 01:44:08 EDT 2010
Author: ndkhoiits
Date: 2010-04-14 01:44:07 -0400 (Wed, 14 Apr 2010)
New Revision: 2613
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
Log:
GTNPORTAL-998 Some nodes have pageReference but the associated Page does not exist, we want to display these nodes in edit navigation, so add accessNodeWithioutPage paramater into filterNodeNavigation method
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2010-04-13 23:40:08 UTC (rev 2612)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2010-04-14 05:44:07 UTC (rev 2613)
@@ -143,7 +143,7 @@
// Still keep this method to have compatibility with legacy code
public static PageNavigation filter(PageNavigation nav, String userName) throws Exception
{
- return filterNavigation(nav, userName, false);
+ return filterNavigation(nav, userName, false, true);
}
/**
@@ -151,10 +151,11 @@
* @param nav
* @param userName
* @param acceptNonDisplayedNode
+ * @param acceptNodeWithoutPage
* @return
* @throws Exception
*/
- public static PageNavigation filterNavigation(PageNavigation nav, String userName, boolean acceptNonDisplayedNode) throws Exception
+ public static PageNavigation filterNavigation(PageNavigation nav, String userName, boolean acceptNonDisplayedNode, boolean acceptNodeWithoutPage) throws Exception
{
PageNavigation filter = nav.clone();
filter.setNodes(new ArrayList<PageNode>());
@@ -167,12 +168,44 @@
for (PageNode node : nav.getNodes())
{
- PageNode newNode = filterNodeNavigation(node, userName, acceptNonDisplayedNode, userService, userACL);
+ PageNode newNode = filterNodeNavigation(node, userName, acceptNonDisplayedNode, acceptNodeWithoutPage, userService, userACL);
if (newNode != null)
filter.addNode(newNode);
}
return filter;
}
+
+ /**
+ * use {@link #filterNavigation(PageNavigation, String, boolean, boolean)}
+ *
+ * @param nav
+ * @param userName
+ * @param acceptNonDisplayedNode
+ * @return
+ * @throws Exception
+ */
+ @Deprecated
+ public static PageNavigation filterNavigation(PageNavigation nav, String userName, boolean acceptNonDisplayedNode) throws Exception
+ {
+ return filterNavigation(nav, userName, acceptNonDisplayedNode, true);
+ }
+
+ /**
+ * Use {@link #filterNodeNavigation(PageNode, String, boolean, boolean, UserPortalConfigService, UserACL)}
+ * @param startNode
+ * @param userName
+ * @param acceptNonDisplayedNode
+ * @param userService
+ * @param userACL
+ * @return
+ * @throws Exception
+ */
+ @Deprecated
+ private static PageNode filterNodeNavigation(PageNode startNode, String userName, boolean acceptNonDisplayedNode,
+ UserPortalConfigService userService, UserACL userACL) throws Exception {
+ PageNode cloneStartNode = filterNodeNavigation(startNode, userName, acceptNonDisplayedNode, false, userService, userACL);
+ return cloneStartNode;
+ }
/**
* PageNode won't be processed in following cases:
@@ -181,16 +214,19 @@
*
* Case 2: Node 's visibility is not SYSTEM but the node is not display and the acceptNonDisplayedNode = false
*
- * Case 3: Node has non null pageReference but the associated Page does not exist
+ * Case 3: Node has non null pageReference but the associated Page does not exist and not accept this node is without page
*
*
* @param startNode
* @param userName
+ * @param acceptNonDisplayedNode
+ * @param acceptNodeWithoutPage
* @param userService
+ * @param userACL
* @return
* @throws Exception
*/
- private static PageNode filterNodeNavigation(PageNode startNode, String userName, boolean acceptNonDisplayedNode,
+ private static PageNode filterNodeNavigation(PageNode startNode, String userName, boolean acceptNonDisplayedNode, boolean acceptNodeWithoutPage,
UserPortalConfigService userService, UserACL userACL) throws Exception
{
@@ -199,7 +235,7 @@
boolean doNothingCase_1 = nodeVisibility == Visibility.SYSTEM && (!userACL.getSuperUser().equals(userName) || !acceptNonDisplayedNode);
boolean doNothingCase_2 = nodeVisibility != Visibility.SYSTEM && !startNode.isDisplay() && !acceptNonDisplayedNode;
- boolean doNothingCase_3 = (pageReference != null) && (userService.getPage(pageReference, userName) == null);
+ boolean doNothingCase_3 = (pageReference != null) && (userService.getPage(pageReference, userName) == null) && !acceptNodeWithoutPage;
@@ -217,7 +253,7 @@
{
for (PageNode child : children)
{
- PageNode filteredChildNode = filterNodeNavigation(child, userName, acceptNonDisplayedNode, userService, userACL);
+ PageNode filteredChildNode = filterNodeNavigation(child, userName, acceptNonDisplayedNode, acceptNodeWithoutPage, userService, userACL);
if (filteredChildNode != null)
{
filteredChildren.add(filteredChildNode);
More information about the gatein-commits
mailing list