Author: chris.laprun(a)jboss.com
Date: 2011-07-19 15:06:54 -0400 (Tue, 19 Jul 2011)
New Revision: 6888
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
Log:
- Extracted common behavior to SiteImpl class and added GroupSiteImpl and
DashboardSiteImpl.
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java 2011-07-19
19:06:54 UTC (rev 6888)
@@ -0,0 +1,48 @@
+/*
+* 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.gatein.api.id.Id;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
+public class DashboardSiteImpl extends SiteImpl
+{
+ public DashboardSiteImpl(Id<? extends Site> siteId, String name, GateInImpl
gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ @Override
+ protected SiteKey getSiteKey()
+ {
+ return SiteKey.user(getName());
+ }
+
+ public Type getType()
+ {
+ return Type.DASHBOARD;
+ }
+}
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java 2011-07-19
19:06:54 UTC (rev 6888)
@@ -0,0 +1,48 @@
+/*
+* 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.gatein.api.id.Id;
+import org.gatein.api.portal.Site;
+import org.gatein.portal.api.impl.GateInImpl;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
+public class GroupSiteImpl extends SiteImpl
+{
+ public GroupSiteImpl(Id<? extends Site> siteId, String name, GateInImpl gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ @Override
+ protected SiteKey getSiteKey()
+ {
+ return SiteKey.group(getName());
+ }
+
+ public Type getType()
+ {
+ return Type.GROUP;
+ }
+}
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-07-19
12:19:04 UTC (rev 6887)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-07-19
19:06:54 UTC (rev 6888)
@@ -23,23 +23,14 @@
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.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.api.util.Container;
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 class PortalImpl extends SiteImpl implements Portal
{
public PortalImpl(PortalData portal, GateInImpl gateIn)
@@ -52,57 +43,13 @@
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)
+ protected SiteKey getSiteKey()
{
- return null; //To change body of implemented methods use File | Settings | File
Templates.
+ return SiteKey.portal(getName());
}
-
- 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();
- }
- }
}
Added:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
(rev 0)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-07-19
19:06:54 UTC (rev 6888)
@@ -0,0 +1,97 @@
+/*
+* 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.gatein.api.id.Id;
+import org.gatein.api.portal.Navigation;
+import org.gatein.api.portal.Page;
+import org.gatein.api.portal.Site;
+import org.gatein.api.util.Container;
+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 abstract class SiteImpl extends IdentifiableImpl implements Site
+{
+ public SiteImpl(Id<? extends Site> siteId, String name, GateInImpl gateIn)
+ {
+ super(siteId, name, gateIn);
+ }
+
+ 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(getSiteKey());
+
+ NodeModel<NavigationImpl> nodeModel = new
NavigationImpl.NavigationNodeModel(getId(), gateIn);
+
+ return service.loadNode(nodeModel, navigation, Scope.CHILDREN, null).getNode();
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+
+ public int getPriority()
+ {
+ GateInImpl gateIn = getGateInImpl();
+ NavigationService service = gateIn.getNavigationService();
+
+ try
+ {
+ gateIn.begin();
+ NavigationContext navigation = service.loadNavigation(getSiteKey());
+
+ NavigationState state = navigation.getState();
+ return state != null ? state.getPriority() : 1;
+ }
+ finally
+ {
+ gateIn.end();
+ }
+ }
+
+ public Navigation createNavigationTo(Page node, Navigation parent)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ protected abstract SiteKey getSiteKey();
+}