Author: chris.laprun(a)jboss.com
Date: 2011-08-09 05:19:28 -0400 (Tue, 09 Aug 2011)
New Revision: 7024
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
Log:
- Finished Navigation implementation for now marking createAndAdd as not yet implemented.
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-08-09
09:10:33 UTC (rev 7023)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-08-09
09:19:28 UTC (rev 7024)
@@ -42,6 +42,7 @@
import org.gatein.api.portal.Page;
import org.gatein.api.portal.Site;
import org.gatein.api.util.IterableIdentifiableCollection;
+import org.gatein.common.NotYetImplemented;
import org.gatein.common.net.URLTools;
import org.gatein.common.text.EntityEncoder;
import org.gatein.common.util.EmptyResourceBundle;
@@ -223,9 +224,14 @@
{
loadChildrenIfNeeded();
- return context.get(navigationId.toString()) != null;
+ return getChild(navigationId) != null;
}
+ private <U extends Navigation> NodeContext<NavigationImpl>
getChild(Id<U> navigationId)
+ {
+ return context.get(navigationId.getComponent(GateInImpl.NAVIGATION_COMPONENT));
+ }
+
public Navigation createAndAdd(String key)
{
return createAndAdd(getIdForChild(key));
@@ -233,7 +239,7 @@
public <U extends Navigation> U createAndAdd(Id<U> navigationId)
{
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ throw new NotYetImplemented(); // TODO
}
public Navigation get(String key)
@@ -243,7 +249,17 @@
public <U extends Navigation> U get(Id<U> navigationId)
{
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ if (navigationId == null)
+ {
+ return null;
+ }
+ else
+ {
+ loadChildrenIfNeeded();
+ final Class<U> type = navigationId.getIdentifiableType();
+ final NodeContext<NavigationImpl> child = getChild(navigationId);
+ return child != null ? type.cast(child.getNode()) : null;
+ }
}
public Id<Navigation> getIdForChild(String key)
Show replies by date