Author: julien_viet
Date: 2011-08-16 05:13:51 -0400 (Tue, 16 Aug 2011)
New Revision: 7147
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/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/PortalImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java
Log:
improve site id
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-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -264,7 +264,7 @@
public Portal getDefaultPortal()
{
- return getPortal(siteId(Site.PORTAL, "classic")); // todo: check
+ return getPortal(Site.Id.createPortal("classic")); // todo: check
}
public IterableIdentifiableCollection<Site> getSites()
@@ -372,9 +372,9 @@
sb.append("/").append(name);
}
String groupId = sb.toString();
- Site.Id siteId = siteId(Site.GROUP, groupId);
+ Site.Id siteId = Site.Id.createGroup(groupId);
- return new GroupSiteImpl(siteId, groupId, this);
+ return new GroupSiteImpl(siteId, this);
}
public IterableIdentifiableCollection<Site> getGroupSites(String userId)
@@ -479,9 +479,9 @@
public Site getDashboard(String userId)
{
- Site.Id siteId = siteId(Site.DASHBOARD, userId);
+ Site.Id siteId = Site.Id.createDashboard(userId);
- return new DashboardSiteImpl(siteId, userId, this);
+ return new DashboardSiteImpl(siteId, this);
}
public <T extends Identifiable<T>> T get(Id<T> id)
@@ -653,11 +653,6 @@
}
*/
- public Site.Id siteId(Type<Site> siteType, String portalName)
- {
- return new Site.Id(siteType, portalName);
- }
-
public Page.Id pageId(Site.Id ownerSite, String pageName)
{
ParameterValidation.throwIllegalArgExceptionIfNull(ownerSite, "Owner Site
Id");
Modified:
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 2011-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/DashboardSiteImpl.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -30,9 +30,9 @@
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
public class DashboardSiteImpl extends SiteImpl
{
- public DashboardSiteImpl(Site.Id siteId, String name, GateInImpl gateIn)
+ public DashboardSiteImpl(Site.Id siteId, GateInImpl gateIn)
{
- super(siteId, name, gateIn);
+ super(siteId, gateIn);
}
@Override
Modified:
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 2011-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/GroupSiteImpl.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -31,9 +31,9 @@
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
public class GroupSiteImpl extends SiteImpl
{
- public GroupSiteImpl(Site.Id siteId, String name, GateInImpl gateIn)
+ public GroupSiteImpl(Site.Id siteId, GateInImpl gateIn)
{
- super(siteId, name, gateIn);
+ super(siteId, gateIn);
}
@Override
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-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/PortalImpl.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -37,7 +37,7 @@
public PortalImpl(PortalData portal, GateInImpl gateIn)
{
- super(gateIn.siteId(getAPITypeFrom(portal.getKey()), portal.getKey().getId()),
portal.getName(), gateIn);
+ super(Site.Id.create(getAPITypeFrom(portal.getKey()), portal.getKey().getId()),
gateIn);
}
public ContentRegistry getContentRegistry()
Modified:
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 2011-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -61,9 +61,9 @@
/** . */
final PageContainer pages;
- public SiteImpl(Site.Id siteId, String name, GateInImpl gateIn)
+ public SiteImpl(Site.Id siteId, GateInImpl gateIn)
{
- super(siteId, name, gateIn);
+ super(siteId, siteId.getName(), gateIn);
//
this.pages = new PageContainer();
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java 2011-08-16
08:57:17 UTC (rev 7146)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/NavigationTestCase.java 2011-08-16
09:13:51 UTC (rev 7147)
@@ -94,7 +94,7 @@
public void testEmptyNavigation()
{
- Site site = gatein.getPortal(new Site.Id(Site.PORTAL, "classic"));
+ Site site = gatein.getPortal(Site.Id.createPortal("classic"));
assertNotNull(site);
Site.Id id = site.getId();
assertEquals(Site.PORTAL, id.getType());
@@ -114,7 +114,7 @@
navService.saveNode(root, null);
//
- Site site = gatein.getPortal(new Site.Id(Site.PORTAL, "classic"));
+ Site site = gatein.getPortal(Site.Id.createPortal("classic"));
Navigation rootNav = site.getNavigation();
Iterator<? extends Navigation> i = rootNav.getChildren().iterator();
assertTrue(i.hasNext());
@@ -132,7 +132,7 @@
navService.saveNode(root, null);
//
- Site site = gatein.getPortal(new Site.Id(Site.PORTAL, "classic"));
+ Site site = gatein.getPortal(Site.Id.createPortal("classic"));
Page homePage = site.getPage("homepage");
assertNotNull(homePage);