Author: julien_viet
Date: 2010-02-20 19:58:50 -0500 (Sat, 20 Feb 2010)
New Revision: 1789
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceCustomizationContextImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
Log:
remove redundant code
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java
===================================================================
---
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -32,7 +32,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public interface Page extends TemplatizedObject, WorkspaceCustomizationContext
+public interface Page extends TemplatizedObject
{
/**
@@ -124,4 +124,10 @@
*/
<T extends TemplatizedObject> Collection<? extends T>
getTemplatizedObjects(ObjectType<T> templatizedType);
+ /**
+ * Returns the customization context of this object;
+ *
+ * @return the customization context
+ */
+ WorkspaceCustomizationContext getCustomizationContext();
}
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java
===================================================================
---
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -24,7 +24,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public interface Site extends WorkspaceObject, WorkspaceCustomizationContext
+public interface Site extends WorkspaceObject
{
/**
@@ -67,4 +67,10 @@
*/
void destroy();
+ /**
+ * Returns the customization context of this object;
+ *
+ * @return the customization context
+ */
+ WorkspaceCustomizationContext getCustomizationContext();
}
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -31,11 +31,7 @@
import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.WorkspaceObject;
import org.gatein.mop.api.workspace.TemplatizedObject;
-import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
import org.gatein.mop.api.workspace.link.PageLink;
-import org.gatein.mop.api.content.CustomizationContext;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.core.util.AbstractAttributes;
@@ -48,7 +44,7 @@
* @version $Revision$
*/
@PrimaryType(name = "mop:page")
-public abstract class PageImpl extends WorkspaceObjectImpl implements Page,
WorkspaceCustomizationContext
+public abstract class PageImpl extends WorkspaceObjectImpl implements Page
{
/** . */
@@ -109,43 +105,6 @@
@OneToOne(type = RelationshipType.EMBEDDED)
public abstract WorkspaceCustomizationContextImpl getCustomizationContext();
- // WorkspaceCustomizationContext implementation
**********************************************************************
-
- public String getContextType()
- {
- return getCustomizationContext().getContextType();
- }
-
- public String getContextId()
- {
- return getCustomizationContext().getContextId();
- }
-
- public boolean contains(CustomizationContext that)
- {
- return getCustomizationContext().contains(that);
- }
-
- public Customization<?> getCustomization(String name)
- {
- return getCustomizationContext().getCustomization(name);
- }
-
- public <S> Customization<S> customize(String name, ContentType<S>
contentType, String contentId, S state)
- {
- return getCustomizationContext().customize(name, contentType, contentId, state);
- }
-
- public <S> Customization<S> customize(String name, Customization<S>
customization)
- {
- return getCustomizationContext().customize(name, customization);
- }
-
- public String nameOf(Customization customization)
- {
- return getCustomizationContext().nameOf(customization);
- }
-
//
*******************************************************************************************************************
public <T extends TemplatizedObject> Collection<? extends T>
getTemplatizedObjects(ObjectType<T> templatizedType)
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -28,10 +28,6 @@
import org.gatein.mop.api.workspace.Site;
import org.gatein.mop.api.workspace.Page;
import org.gatein.mop.api.workspace.ObjectType;
-import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
-import org.gatein.mop.api.content.CustomizationContext;
-import org.gatein.mop.api.content.Customization;
-import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.core.api.MOPFormatter;
/**
@@ -40,7 +36,7 @@
*/
@FormattedBy(MOPFormatter.class)
@PrimaryType(name = "mop:site")
-public abstract class SiteImpl<C extends SiteContainer> extends WorkspaceObjectImpl
implements Site, WorkspaceCustomizationContext
+public abstract class SiteImpl<C extends SiteContainer> extends WorkspaceObjectImpl
implements Site
{
@OneToOne
@@ -74,41 +70,4 @@
{
return getRoot();
}
-
- // WorkspaceCustomizationContext implementation
**********************************************************************
-
- public String getContextType()
- {
- return getCustomizationContext().getContextType();
- }
-
- public String getContextId()
- {
- return getCustomizationContext().getContextId();
- }
-
- public boolean contains(CustomizationContext that)
- {
- return getCustomizationContext().contains(that);
- }
-
- public Customization<?> getCustomization(String name)
- {
- return getCustomizationContext().getCustomization(name);
- }
-
- public <S> Customization<S> customize(String name, ContentType<S>
contentType, String contentId, S state)
- {
- return getCustomizationContext().customize(name, contentType, contentId, state);
- }
-
- public <S> Customization<S> customize(String name, Customization<S>
customization)
- {
- return getCustomizationContext().customize(name, customization);
- }
-
- public String nameOf(Customization customization)
- {
- return getCustomizationContext().nameOf(customization);
- }
}
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceCustomizationContextImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceCustomizationContextImpl.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceCustomizationContextImpl.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -23,7 +23,6 @@
import org.chromattic.api.annotations.MappedBy;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.PrimaryType;
-import org.chromattic.api.annotations.RelatedMappedBy;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.CustomizationContext;
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -176,12 +176,12 @@
else if (contained instanceof PageImpl)
{
PageImpl page = (PageImpl)contained;
- return contains(container, page.getSite());
+ return contains(container, page.getSite().getCustomizationContext());
}
else if (contained instanceof UIWindowImpl)
{
UIWindowImpl window = (UIWindowImpl)contained;
- return contains(container, window.getPage());
+ return contains(container, window.getPage().getCustomizationContext());
}
}
if (container instanceof SiteImpl)
@@ -189,12 +189,12 @@
if (contained instanceof PageImpl)
{
PageImpl page = (PageImpl)contained;
- return contains(container, page.getSite());
+ return contains(container, page.getSite().getCustomizationContext());
}
else if (contained instanceof UIWindowImpl)
{
UIWindowImpl window = (UIWindowImpl)contained;
- return contains(container, window.getPage());
+ return contains(container, window.getPage().getCustomizationContext());
}
}
if (container instanceof PageImpl)
@@ -202,7 +202,7 @@
if (contained instanceof UIWindowImpl)
{
UIWindowImpl window = (UIWindowImpl)contained;
- return contains(container, window.getPage());
+ return contains(container, window.getPage().getCustomizationContext());
}
}
return false;
Modified:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java
===================================================================
---
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2010-02-20
17:47:58 UTC (rev 1788)
+++
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/content/CustomizationTestCase.java 2010-02-21
00:58:50 UTC (rev 1789)
@@ -128,12 +128,12 @@
UIWindow window = layout.add(ObjectType.WINDOW, "window");
//
- Customization<Preferences> workspaceCustomization =
portal.customize("marseille", Preferences.CONTENT_TYPE,
"WeatherPortlet", marseille);
+ Customization<Preferences> workspaceCustomization =
portal.getCustomizationContext().customize("marseille",
Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization =
window.customize(workspaceCustomization);
//
assertNotNull(windowCustomization);
- assertEquals(Arrays.<CustomizationContext>asList(window, portal), new
ArrayList<CustomizationContext>(windowCustomization.getContexts()));
+ assertEquals(Arrays.<CustomizationContext>asList(window,
portal.getCustomizationContext()), new
ArrayList<CustomizationContext>(windowCustomization.getContexts()));
assertSame(windowCustomization, window.getCustomization());
assertTrue(((Customization)windowCustomization) instanceof
WorkspaceSpecialization);
@@ -163,7 +163,7 @@
UIWindow window = layout.add(ObjectType.WINDOW, "window");
//
- Customization<Preferences> workspaceCustomization =
portal.customize("marseille", Preferences.CONTENT_TYPE,
"WeatherPortlet", marseille);
+ Customization<Preferences> workspaceCustomization =
portal.getCustomizationContext().customize("marseille",
Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization =
window.customize(workspaceCustomization);
//
@@ -182,7 +182,7 @@
UIWindow window = layout.add(ObjectType.WINDOW, "window");
//
- Customization<Preferences> workspaceCustomization =
portal.customize("marseille", Preferences.CONTENT_TYPE,
"WeatherPortlet", marseille);
+ Customization<Preferences> workspaceCustomization =
portal.getCustomizationContext().customize("marseille",
Preferences.CONTENT_TYPE, "WeatherPortlet", marseille);
Customization<Preferences> windowCustomization =
window.customize(workspaceCustomization);
//