Author: chris.laprun(a)jboss.com
Date: 2011-08-02 17:48:34 -0400 (Tue, 02 Aug 2011)
New Revision: 6984
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java
Log:
- Renamed CONTEXT to SITE_CONTEXT and extracted constants from component names so that
they can be used elsewhere.
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-02
21:46:56 UTC (rev 6983)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-08-02
21:48:34 UTC (rev 6984)
@@ -36,7 +36,6 @@
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.description.DescriptionService;
import org.exoplatform.portal.mop.navigation.NavigationService;
-import org.exoplatform.portal.pom.data.DashboardData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PageKey;
@@ -90,9 +89,11 @@
private static final Query<PortalData> PORTALS = new
Query<PortalData>(SiteType.PORTAL.getName(), null, PortalData.class);
private static final String GROUP_CHARS = "\\w|-|_";
- public static final Context CONTEXT = GenericContext.builder()
- .requiredComponent("owner", Site.class,
Pattern.compile(Site.PORTAL_TYPE_NAME + "|" + Site.GROUP_TYPE_NAME +
"|" + Site.DASHBOARD_TYPE_NAME))
- .requiredComponent("portal", Portal.class, Pattern.compile("("
+ GROUP_CHARS + "|\\/)+"))
+ public static final String SITE_OWNER_COMPONENT = "owner";
+ public static final String SITE_NAME_COMPONENT = "name";
+ public static final Context SITE_CONTEXT = GenericContext.builder()
+ .requiredComponent(SITE_OWNER_COMPONENT, Identifiable.class,
Pattern.compile(Site.PORTAL_TYPE_NAME + "|" + Site.GROUP_TYPE_NAME +
"|" + Site.DASHBOARD_TYPE_NAME))
+ .requiredComponent(SITE_NAME_COMPONENT, Site.class, Pattern.compile("(" +
GROUP_CHARS + "|\\/)+"))
.optionalComponent("page", Page.class,
Pattern.compile("\\w+"))
.withDefaultSeparator("::").build();
public static final Context GROUP_CONTEXT =
GenericContext.builder().requiredUnboundedHierarchicalComponent("group",
Identifiable.class, Pattern.compile("(" + GROUP_CHARS + ")+"))
@@ -364,7 +365,7 @@
for (PortalData portalData : portalDatas)
{
- if(filter.accept(portalData))
+ if (filter.accept(portalData))
{
portals.add(new PortalImpl(portalData, this));
}
@@ -496,7 +497,7 @@
public <T extends Site> Id<T> siteId(Type<T> siteType, String
siteName)
{
- return CONTEXT.create(siteType.getValueType(), siteType.getName(), siteName);
+ return SITE_CONTEXT.create(siteType.getValueType(), siteType.getName(), siteName);
}
public <T extends Site> Id<Page> pageId(Id<T> ownerSite, String
pageName)