Author: chris.laprun(a)jboss.com
Date: 2011-07-15 17:29:28 -0400 (Fri, 15 Jul 2011)
New Revision: 6874
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/
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/PortalImpl.java
Removed:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/NavigationImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/PortalImpl.java
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
Log:
- Moved NavigationImpl and PortalImpl to portal package.
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-15
21:24:39 UTC (rev 6873)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-07-15
21:29:28 UTC (rev 6874)
@@ -48,6 +48,7 @@
import org.gatein.api.portal.Page;
import org.gatein.api.portal.Portal;
import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.portal.PortalImpl;
import org.picocontainer.Startable;
import java.net.URI;
@@ -93,7 +94,7 @@
}
}
- void end()
+ public void end()
{
RequestLifeCycle.end();
}
@@ -215,12 +216,12 @@
// nothing to do
}
- ModelDataStorage getDataStorage()
+ public ModelDataStorage getDataStorage()
{
return dataStorage;
}
- NavigationService getNavigationService()
+ public NavigationService getNavigationService()
{
return navigationService;
}
@@ -244,7 +245,7 @@
}
}
- void begin()
+ public void begin()
{
RequestLifeCycle.begin(container);
}
Deleted:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/NavigationImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/NavigationImpl.java 2011-07-15
21:24:39 UTC (rev 6873)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/NavigationImpl.java 2011-07-15
21:29:28 UTC (rev 6874)
@@ -1,178 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.gatein.portal.api.impl;
-
-import org.exoplatform.portal.mop.navigation.NodeContext;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.NodeState;
-import org.gatein.api.Filter;
-import org.gatein.api.GateIn;
-import org.gatein.api.IterableResult;
-import org.gatein.api.Query;
-import org.gatein.api.id.Context;
-import org.gatein.api.id.Id;
-import org.gatein.api.id.Identifiable;
-import org.gatein.api.portal.Navigation;
-import org.gatein.api.portal.Page;
-import org.gatein.api.portal.Site;
-
-import java.util.Iterator;
-import java.util.regex.Pattern;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
-public class NavigationImpl implements Navigation, Identifiable<Navigation>
-{
- private final NodeContext<NavigationImpl> context;
- private Id<? extends Site> site;
- private Id<Navigation> id;
- private final GateInImpl gateIn;
-
- private final static Context CONTEXT =
Context.builder().requiredComponent("navigation", Navigation.class,
Pattern.compile("[a-z0-9]+")).build();
-
- public NavigationImpl(Id<Site> siteId, NodeContext<NavigationImpl>
context, GateInImpl gateIn)
- {
- this.context = context;
- this.site = siteId;
- this.gateIn = gateIn;
- }
-
- @Override
- public String toString()
- {
- String s = "Navigation@" + getId() + " target:" +
context.getState().getPageRef() + "\nchildren:\n";
- Iterator<NavigationImpl> children = context.iterator();
- while (children.hasNext())
- {
- s += " " + children.next() + "\n";
- }
- return s;
- }
-
- public NodeContext<NavigationImpl> getContext()
- {
- return context;
- }
-
- public Page getTargetPage()
- {
- return null;
- }
-
- public void setTargetPage(Page target)
- {
- setTargetPage(target.getId());
- }
-
- public void setTargetPage(Id<Page> targetId)
- {
- context.setState(new
NodeState.Builder(context.getState()).pageRef(targetId.toString()).build());
- }
-
- public Site getSite()
- {
- return getGateIn().get(site);
- }
-
- public IterableResult<Navigation> getAll()
- {
-// context.getNodes()
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public int size()
- {
- return context.getNodeSize();
- }
-
- public boolean contains(String key)
- {
- return false; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public Navigation createAndAdd(String key)
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public Navigation get(String key)
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public <U extends Navigation> IterableResult<U>
getAllWhere(Filter<U> filter)
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public <U extends Navigation> IterableResult<U>
getAllSatisfying(Query<U> query)
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public Id<Navigation> getId()
- {
- if (id == null)
- {
- id = Id.create(CONTEXT, Navigation.class, context.getId());
- }
-
- return id;
- }
-
- public String getName()
- {
- return context.getName();
- }
-
- public String getDisplayName()
- {
- return getName();
- }
-
- public GateIn getGateIn()
- {
- return gateIn;
- }
-
- static class NavigationNodeModel implements NodeModel<NavigationImpl>
- {
- private final Id<Site> siteId;
- private final GateInImpl gateIn;
-
- NavigationNodeModel(Id<Site> siteId, GateInImpl gateIn)
- {
- this.siteId = siteId;
- this.gateIn = gateIn;
- }
-
- public NodeContext<NavigationImpl> getContext(NavigationImpl node)
- {
- return node.context;
- }
-
- public NavigationImpl create(NodeContext<NavigationImpl> context)
- {
- return new NavigationImpl(siteId, context, gateIn);
- }
- }
-}
Deleted:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/PortalImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/PortalImpl.java 2011-07-15
21:24:39 UTC (rev 6873)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/PortalImpl.java 2011-07-15
21:29:28 UTC (rev 6874)
@@ -1,106 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.gatein.portal.api.impl;
-
-import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.mop.navigation.NavigationContext;
-import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.mop.navigation.NavigationState;
-import org.exoplatform.portal.mop.navigation.NodeModel;
-import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.gatein.api.Container;
-import org.gatein.api.content.ContentRegistry;
-import org.gatein.api.portal.Navigation;
-import org.gatein.api.portal.Page;
-import org.gatein.api.portal.Portal;
-import org.gatein.api.portal.Site;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
-public class PortalImpl extends IdentifiableImpl implements Portal
-{
-
- public PortalImpl(PortalData portal, GateInImpl gateIn)
- {
- super(gateIn.siteId(Site.Type.forName(portal.getKey().getType()),
portal.getKey().getId()), portal.getName(), gateIn);
- }
-
- public ContentRegistry getContentRegistry()
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public Container<String, Page> getPageRegistry()
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public Navigation getNavigation()
- {
- GateInImpl gateIn = getGateInImpl();
- NavigationService service = gateIn.getNavigationService();
-
- try
- {
- gateIn.begin();
- NavigationContext navigation =
service.loadNavigation(SiteKey.portal(getName()));
-
- NodeModel<NavigationImpl> nodeModel = new
NavigationImpl.NavigationNodeModel(getId(), gateIn);
-
- return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
- }
- finally
- {
- gateIn.end();
- }
- }
-
- public Type getType()
- {
- return Type.PORTAL;
- }
-
- public Navigation createNavigationTo(Page node, Navigation parent)
- {
- return null; //To change body of implemented methods use File | Settings | File
Templates.
- }
-
- public int getPriority()
- {
- GateInImpl gateIn = getGateInImpl();
- NavigationService service = gateIn.getNavigationService();
-
- try
- {
- gateIn.begin();
- NavigationContext navigation =
service.loadNavigation(SiteKey.portal(getName()));
-
- NavigationState state = navigation.getState();
- return state != null ? state.getPriority() : 1;
- }
- finally
- {
- gateIn.end();
- }
- }
-}
Copied:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
(from rev 6873,
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/NavigationImpl.java)
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-07-15
21:29:28 UTC (rev 6874)
@@ -0,0 +1,179 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.mop.navigation.NodeContext;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.NodeState;
+import org.gatein.api.Filter;
+import org.gatein.api.GateIn;
+import org.gatein.api.IterableResult;
+import org.gatein.api.Query;
+import org.gatein.api.id.Context;
+import org.gatein.api.id.Id;
+import org.gatein.api.id.Identifiable;
+import org.gatein.api.portal.Navigation;
+import org.gatein.api.portal.Page;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+
+import java.util.Iterator;
+import java.util.regex.Pattern;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
+public class NavigationImpl implements Navigation, Identifiable<Navigation>
+{
+ private final NodeContext<NavigationImpl> context;
+ private Id<? extends Site> site;
+ private Id<Navigation> id;
+ private final GateInImpl gateIn;
+
+ private final static Context CONTEXT =
Context.builder().requiredComponent("navigation", Navigation.class,
Pattern.compile("[a-z0-9]+")).build();
+
+ public NavigationImpl(Id<Site> siteId, NodeContext<NavigationImpl>
context, GateInImpl gateIn)
+ {
+ this.context = context;
+ this.site = siteId;
+ this.gateIn = gateIn;
+ }
+
+ @Override
+ public String toString()
+ {
+ String s = "Navigation@" + getId() + " target:" +
context.getState().getPageRef() + "\nchildren:\n";
+ Iterator<NavigationImpl> children = context.iterator();
+ while (children.hasNext())
+ {
+ s += " " + children.next() + "\n";
+ }
+ return s;
+ }
+
+ public NodeContext<NavigationImpl> getContext()
+ {
+ return context;
+ }
+
+ public Page getTargetPage()
+ {
+ return null;
+ }
+
+ public void setTargetPage(Page target)
+ {
+ setTargetPage(target.getId());
+ }
+
+ public void setTargetPage(Id<Page> targetId)
+ {
+ context.setState(new
NodeState.Builder(context.getState()).pageRef(targetId.toString()).build());
+ }
+
+ public Site getSite()
+ {
+ return getGateIn().get(site);
+ }
+
+ public IterableResult<Navigation> getAll()
+ {
+// context.getNodes()
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public int size()
+ {
+ return context.getNodeSize();
+ }
+
+ public boolean contains(String key)
+ {
+ return false; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Navigation createAndAdd(String key)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Navigation get(String key)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public <U extends Navigation> IterableResult<U>
getAllWhere(Filter<U> filter)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public <U extends Navigation> IterableResult<U>
getAllSatisfying(Query<U> query)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Id<Navigation> getId()
+ {
+ if (id == null)
+ {
+ id = Id.create(CONTEXT, Navigation.class, context.getId());
+ }
+
+ return id;
+ }
+
+ public String getName()
+ {
+ return context.getName();
+ }
+
+ public String getDisplayName()
+ {
+ return getName();
+ }
+
+ public GateIn getGateIn()
+ {
+ return gateIn;
+ }
+
+ static class NavigationNodeModel implements NodeModel<NavigationImpl>
+ {
+ private final Id<Site> siteId;
+ private final GateInImpl gateIn;
+
+ NavigationNodeModel(Id<Site> siteId, GateInImpl gateIn)
+ {
+ this.siteId = siteId;
+ this.gateIn = gateIn;
+ }
+
+ public NodeContext<NavigationImpl> getContext(NavigationImpl node)
+ {
+ return node.context;
+ }
+
+ public NavigationImpl create(NodeContext<NavigationImpl> context)
+ {
+ return new NavigationImpl(siteId, context, gateIn);
+ }
+ }
+}
Copied:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
(from rev 6873,
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/PortalImpl.java)
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-07-15
21:29:28 UTC (rev 6874)
@@ -0,0 +1,108 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.gatein.portal.api.impl.portal;
+
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.NavigationContext;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.navigation.NodeModel;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.gatein.api.Container;
+import org.gatein.api.content.ContentRegistry;
+import org.gatein.api.portal.Navigation;
+import org.gatein.api.portal.Page;
+import org.gatein.api.portal.Portal;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+import org.gatein.portal.api.impl.IdentifiableImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
+public class PortalImpl extends IdentifiableImpl implements Portal
+{
+
+ public PortalImpl(PortalData portal, GateInImpl gateIn)
+ {
+ super(gateIn.siteId(Site.Type.forName(portal.getKey().getType()),
portal.getKey().getId()), portal.getName(), gateIn);
+ }
+
+ public ContentRegistry getContentRegistry()
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Container<String, Page> getPageRegistry()
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Navigation getNavigation()
+ {
+ GateInImpl gateIn = getGateInImpl();
+ NavigationService service = gateIn.getNavigationService();
+
+ try
+ {
+ gateIn.begin();
+ NavigationContext navigation =
service.loadNavigation(SiteKey.portal(getName()));
+
+ NodeModel<NavigationImpl> nodeModel = new
NavigationImpl.NavigationNodeModel(getId(), gateIn);
+
+ return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+
+ public Type getType()
+ {
+ return Type.PORTAL;
+ }
+
+ public Navigation createNavigationTo(Page node, Navigation parent)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public int getPriority()
+ {
+ GateInImpl gateIn = getGateInImpl();
+ NavigationService service = gateIn.getNavigationService();
+
+ try
+ {
+ gateIn.begin();
+ NavigationContext navigation =
service.loadNavigation(SiteKey.portal(getName()));
+
+ NavigationState state = navigation.getState();
+ return state != null ? state.getPriority() : 1;
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+}