Author: chris.laprun(a)jboss.com
Date: 2011-08-02 05:59:15 -0400 (Tue, 02 Aug 2011)
New Revision: 6974
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/content/GadgetImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/PortletImpl.java
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/WSRPImpl.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/SiteTestCase.java
Log:
- Adapted for changes in Type API.
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
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/GateInImpl.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -84,7 +84,7 @@
private static final String GROUP_CHARS = "\\w|-|_";
public static final Context CONTEXT = GenericContext.builder()
- .requiredComponent("owner", Site.class, Pattern.compile(Site.PORTAL_NAME
+ "|" + Site.GROUP_NAME + "|" + Site.DASHBOARD_NAME))
+ .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 + "|\\/)+"))
.optionalComponent("page", Page.class,
Pattern.compile("\\w+"))
.withDefaultSeparator("::").build();
@@ -118,7 +118,7 @@
container = context.getContainer();
}
- public <T> T getProperty(Type<T, GateIn> property)
+ public <T> T getProperty(Type<T> property)
{
if (property == null)
{
@@ -130,7 +130,7 @@
return type.cast(o);
}
- public <T> void setProperty(Type<T, GateIn> property, T value)
+ public <T> void setProperty(Type<T> property, T value)
{
if (property != null)
{
@@ -331,7 +331,7 @@
return type.cast(result);
}
- public <T extends Site> T getSite(Id<T> siteId, Type<T, Site> type)
+ public <T extends Site> T getSite(Id<T> siteId, Type<T> type)
{
return null; //To change body of implemented methods use File | Settings | File
Templates.
}
@@ -386,7 +386,7 @@
return CATEGORY_CONTEXT.create(Category.class, name);
}
- public <T extends Site> Id<T> siteId(Type<T, Site> siteType, String
siteName)
+ public <T extends Site> Id<T> siteId(Type<T> siteType, String
siteName)
{
return CONTEXT.create(siteType.getValueType(), siteType.getName(), siteName);
}
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/GadgetImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/GadgetImpl.java 2011-08-02
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/GadgetImpl.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -127,7 +127,7 @@
return gadget.isLocal();
}
- public Type<org.gatein.api.content.Gadget, Content> getType()
+ public Type<org.gatein.api.content.Gadget> getType()
{
return Content.GADGET;
}
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/PortletImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/PortletImpl.java 2011-08-02
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/PortletImpl.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -47,7 +47,7 @@
return "Application '" + getName() + "' @" + getId();
}
- public Type<Portlet, Content> getType()
+ public Type<Portlet> getType()
{
return Content.PORTLET;
}
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/WSRPImpl.java
===================================================================
---
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/WSRPImpl.java 2011-08-02
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/content/WSRPImpl.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -38,7 +38,7 @@
super(id, application.getApplicationName(), gateIn);
}
- public Type<WSRP, Content> getType()
+ public Type<WSRP> getType()
{
return Content.WSRP;
}
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-02
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/SiteImpl.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -33,6 +33,7 @@
import org.gatein.api.portal.Navigation;
import org.gatein.api.portal.Page;
import org.gatein.api.portal.Site;
+import org.gatein.api.util.GateInTypesResolver;
import org.gatein.api.util.HierarchicalContainer;
import org.gatein.api.util.Type;
import org.gatein.portal.api.impl.GateInImpl;
@@ -54,7 +55,7 @@
static Type getAPITypeFrom(OwnerKey key)
{
- return Type.forName(key.getType(), Site.class);
+ return GateInTypesResolver.forName(key.getType(), Site.class);
}
public HierarchicalContainer<String, Page> getPageRegistry()
Modified:
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java
===================================================================
---
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java 2011-08-02
07:20:31 UTC (rev 6973)
+++
portal/branches/api/component/api-impl/src/test/java/org/gatein/portal/api/impl/portal/SiteTestCase.java 2011-08-02
09:59:15 UTC (rev 6974)
@@ -26,12 +26,21 @@
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalKey;
import org.gatein.api.portal.Site;
+import org.gatein.api.util.GateInTypesResolver;
+import org.gatein.api.util.Type;
import org.testng.annotations.Test;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a> */
public class SiteTestCase
{
@Test
+ public void checkThatTypesAreProperlyResolvedEvenIfClassIsNotLoaded()
+ {
+ Type portal = GateInTypesResolver.forName("portal", Site.class);
+ assert portal != null;
+ }
+
+ @Test
public void getAPITypeShouldProperlyResolve()
{
assert Site.DASHBOARD.equals(SiteImpl.getAPITypeFrom(new
PageKey(SiteType.USER.getName(), "foo", "foo")));