Author: chris.laprun(a)jboss.com
Date: 2011-08-04 17:31:41 -0400 (Thu, 04 Aug 2011)
New Revision: 6995
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/NavigationImpl.java
Log:
- Added separators (where needed) and names to Context for easier problem tracking.
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-04
21:30:17 UTC (rev 6994)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-08-04
21:31:41 UTC (rev 6995)
@@ -91,24 +91,25 @@
private static final String GROUP_CHARS = "\\w|-|_";
public static final String SITE_OWNER_COMPONENT = "owner";
public static final String SITE_NAME_COMPONENT = "name";
- public static final Context SITE_CONTEXT = GenericContext.builder()
+ public static final Context SITE_CONTEXT =
GenericContext.builder().named("Site")
.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 + ")+"))
+ public static final Context GROUP_CONTEXT =
GenericContext.builder().named("Group").requiredUnboundedHierarchicalComponent("group",
Identifiable.class, Pattern.compile("(" + GROUP_CHARS + ")+"))
.withDefaultSeparator("/").requireSeparatorInFirstPosition().build();
- public static final Context APPLICATION_CONTEXT =
GenericContext.builder().requiredComponent("application", Identifiable.class,
Pattern.compile("\\w+"))
+ public static final Context APPLICATION_CONTEXT =
GenericContext.builder().named("Application").requiredComponent("application",
Identifiable.class, Pattern.compile("\\w+"))
.requiredComponent("portlet", Portlet.class,
Pattern.compile("\\w+")).withDefaultSeparator("/").build();
- private static final Context GADGET_CONTEXT =
GenericContext.builder().requiredComponent("name", Gadget.class,
Pattern.compile("\\w+")).build();
- private static final Context USER_CONTEXT =
GenericContext.builder().requiredComponent("name", Identifiable.class,
Pattern.compile("[a-zA-Z0-9]+")).build();
- private static final Context CATEGORY_CONTEXT =
GenericContext.builder().requiredComponent("name", Category.class,
Pattern.compile("\\w+")).build();
- private static final Context WSRP_CONTEXT =
GenericContext.builder().requiredComponent("invoker", Identifiable.class,
Pattern.compile("\\w+"))
- .requiredComponent("portletcontext", WSRP.class,
Pattern.compile(GROUP_CHARS + "+")).build();
+ private static final Context GADGET_CONTEXT =
GenericContext.builder().named("Gadget").requiredComponent("name",
Gadget.class, Pattern.compile("\\w+")).build();
+ private static final Context USER_CONTEXT =
GenericContext.builder().named("User").requiredComponent("name",
Identifiable.class, Pattern.compile("[a-zA-Z0-9]+")).build();
+ private static final Context CATEGORY_CONTEXT =
GenericContext.builder().named("Category").requiredComponent("name",
Category.class, Pattern.compile("\\w+")).build();
+ private static final Context WSRP_CONTEXT =
GenericContext.builder().named("WSRP").requiredComponent("invoker",
Identifiable.class, Pattern.compile("\\w+"))
+ .requiredComponent("portletcontext", WSRP.class,
Pattern.compile(GROUP_CHARS +
"+")).withDefaultSeparator(".").build();
private static final String MANAGED = "managed";
- private static final Context MANAGED_CONTENT_CONTEXT = GenericContext.builder()
+ private static final Context MANAGED_CONTENT_CONTEXT =
GenericContext.builder().named("ManagedContent")
.requiredComponent(MANAGED, ManagedContent.class, Pattern.compile(MANAGED))
.requiredComponent("content", Content.class,
Pattern.compile(".+"))
+ .withDefaultSeparator(":")
.build();
private ExoContainer container;
@@ -434,6 +435,7 @@
}
else
{
+ // todo: finish support of other types
throw new UnsupportedOperationException("Id<" +
type.getSimpleName() + "> not yet supported");
}
@@ -442,6 +444,7 @@
public <T extends Site> T getSite(Id<T> siteId, Type<T> type)
{
+ // todo
return null; //To change body of implemented methods use File | Settings | File
Templates.
}
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-04
21:30:17 UTC (rev 6994)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-08-04
21:31:41 UTC (rev 6995)
@@ -70,7 +70,7 @@
private String displayName;
private ResourceBundle bundle;
- private final static Context CONTEXT =
GenericContext.builder().requiredComponent("navigation", Navigation.class,
Pattern.compile("[a-z0-9]+")).build();
+ private final static Context NAVIGATION_CONTEXT =
GenericContext.builder().named("Navigation").requiredComponent("navigation",
Navigation.class, Pattern.compile("[a-z0-9]+")).build();
public NavigationImpl(Id<Site> siteId, NodeContext<NavigationImpl>
context, GateInImpl gateIn)
{
@@ -272,7 +272,7 @@
{
if (id == null)
{
- id = CONTEXT.create(Navigation.class, context.getId());
+ id = NAVIGATION_CONTEXT.create(Navigation.class, context.getId());
}
return id;