Author: julien_viet
Date: 2009-11-10 19:42:33 -0500 (Tue, 10 Nov 2009)
New Revision: 557
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Portlet.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletBuilder.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferenceState.java
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferenceState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferencesState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferencesBuilder.java
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PreferencesHandler.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
Log:
rename Preferences -> Portlet
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -32,13 +32,12 @@
import org.exoplatform.portal.pom.registry.CategoryDefinition;
import org.exoplatform.portal.pom.registry.ContentDefinition;
import org.exoplatform.portal.pom.registry.ContentRegistry;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.gatein.common.i18n.LocalizedString;
import org.gatein.common.util.Tools;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
-import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.info.MetaInfo;
import org.gatein.pc.api.info.PortletInfo;
@@ -378,10 +377,10 @@
//
ExoContainer manager = ExoContainerContext.getCurrentContainer();
PortletInvoker portletInvoker =
(PortletInvoker)manager.getComponentInstance(PortletInvoker.class);
- Set<Portlet> portlets = portletInvoker.getPortlets();
+ Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets();
//
- for (Portlet portlet : portlets)
+ for (org.gatein.pc.api.Portlet portlet : portlets)
{
PortletInfo info = portlet.getInfo();
String portletApplicationName = info.getApplicationName();
@@ -448,7 +447,7 @@
}
else
{
- contentType = Preferences.CONTENT_TYPE;
+ contentType = Portlet.CONTENT_TYPE;
contentId = info.getApplicationName() + "/" +
info.getName();
}
@@ -563,7 +562,7 @@
{
ContentType type = customization.getType();
String contentId = customization.getContentId();
- if (type == Preferences.CONTENT_TYPE)
+ if (type == Portlet.CONTENT_TYPE)
{
String[] chunks = contentId.split("/");
if (chunks.length == 2)
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -23,7 +23,7 @@
import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
/**
@@ -293,19 +293,19 @@
return new Application<Gadget>(ApplicationType.GADGET);
}
- public static Application<Preferences>
createPortletApplication(ApplicationData<Preferences> data)
+ public static Application<Portlet>
createPortletApplication(ApplicationData<Portlet> data)
{
- return new Application<Preferences>(data);
+ return new Application<Portlet>(data);
}
- public static Application<Preferences> createPortletApplication(String
storageId)
+ public static Application<Portlet> createPortletApplication(String storageId)
{
- return new Application<Preferences>(ApplicationType.PORTLET, storageId);
+ return new Application<Portlet>(ApplicationType.PORTLET, storageId);
}
- public static Application<Preferences> createPortletApplication()
+ public static Application<Portlet> createPortletApplication()
{
- return new Application<Preferences>(ApplicationType.PORTLET);
+ return new Application<Portlet>(ApplicationType.PORTLET);
}
public static Application<WSRP>
createWSRPApplication(ApplicationData<WSRP> wsrpwsrpIdApplicationData)
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.gatein.mop.api.content.ContentType;
@@ -75,7 +75,7 @@
}
/** . */
- public static final ApplicationType<Preferences> PORTLET = new
ApplicationType<Preferences>(Preferences.CONTENT_TYPE, "portlet");
+ public static final ApplicationType<Portlet> PORTLET = new
ApplicationType<Portlet>(Portlet.CONTENT_TYPE, "portlet");
/** . */
public static final ApplicationType<Gadget> GADGET = new
ApplicationType<Gadget>(Gadget.CONTENT_TYPE, "gadget");
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -25,7 +25,7 @@
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
/**
@@ -102,7 +102,7 @@
ApplicationType type = applicationData.getType();
if (ApplicationType.PORTLET == type)
{
- return
Application.createPortletApplication((ApplicationData<Preferences>)applicationData);
+ return
Application.createPortletApplication((ApplicationData<Portlet>)applicationData);
}
else if (ApplicationType.GADGET == type)
{
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -26,8 +26,8 @@
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Properties;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.jibx.runtime.IAliasable;
import org.jibx.runtime.IMarshaller;
import org.jibx.runtime.IMarshallingContext;
@@ -100,7 +100,7 @@
ctx.parsePastStartTag(m_uri, m_name);
//
- Application<Preferences> app;
+ Application<Portlet> app;
if ("application".equals(m_name))
{
String instanceId = ctx.parseElementText(m_uri, "instance-id");
@@ -111,10 +111,10 @@
String ownerId = instanceId.substring(i0 + 1, i1);
String persistenceid = instanceId.substring(i1 + 2);
String[] persistenceChunks = split("/", persistenceid);
- TransientApplicationState<Preferences> state;
+ TransientApplicationState<Portlet> state;
if (persistenceChunks.length == 2)
{
- state = new TransientApplicationState<Preferences>(
+ state = new TransientApplicationState<Portlet>(
persistenceChunks[0] + "/" + persistenceChunks[1],
null,
ownerType,
@@ -123,7 +123,7 @@
}
else
{
- state = new TransientApplicationState<Preferences>(
+ state = new TransientApplicationState<Portlet>(
persistenceChunks[0] + "/" + persistenceChunks[1],
null,
ownerType,
@@ -138,10 +138,10 @@
ctx.parsePastStartTag(m_uri, "portlet");
String applicationName = ctx.parseElementText(m_uri,
"application-ref");
String portletName = ctx.parseElementText(m_uri, "portlet-ref");
- TransientApplicationState<Preferences> state;
+ TransientApplicationState<Portlet> state;
if (ctx.isAt(m_uri, "preferences"))
{
- PreferencesBuilder builder = new PreferencesBuilder();
+ PortletBuilder builder = new PortletBuilder();
ctx.parsePastStartTag(m_uri, "preferences");
while (ctx.isAt(m_uri, "preference"))
{
@@ -149,11 +149,11 @@
builder.add(value.getName(), value.getValues(), value.isReadOnly());
}
ctx.parsePastEndTag(m_uri, "preferences");
- state = new TransientApplicationState<Preferences>(applicationName +
"/" + portletName, builder.build());
+ state = new TransientApplicationState<Portlet>(applicationName +
"/" + portletName, builder.build());
}
else
{
- state = new TransientApplicationState<Preferences>(applicationName +
"/" + portletName, null);
+ state = new TransientApplicationState<Portlet>(applicationName +
"/" + portletName, null);
}
app = Application.createPortletApplication();
app.setState(state);
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -19,7 +19,7 @@
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.pom.data.ApplicationData;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
/**
* We keep that subclass here to please JiBX crap.
@@ -27,20 +27,20 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class PortletApplication extends Application<Preferences>
+public class PortletApplication extends Application<Portlet>
{
- public PortletApplication(ApplicationData<Preferences>
preferencesApplicationData)
+ public PortletApplication(ApplicationData<Portlet> preferencesApplicationData)
{
super(preferencesApplicationData);
}
- public PortletApplication(ApplicationType<Preferences>
preferencesApplicationType, String storageId)
+ public PortletApplication(ApplicationType<Portlet> preferencesApplicationType,
String storageId)
{
super(preferencesApplicationType, storageId);
}
- public PortletApplication(ApplicationType<Preferences>
preferencesApplicationType)
+ public PortletApplication(ApplicationType<Portlet> preferencesApplicationType)
{
super(preferencesApplicationType);
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PreferencesHandler.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PreferencesHandler.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PreferencesHandler.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -20,7 +20,7 @@
package org.exoplatform.portal.config.serialize;
import org.exoplatform.portal.application.Preference;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.jibx.runtime.IAliasable;
import org.jibx.runtime.IMarshaller;
import org.jibx.runtime.IMarshallingContext;
@@ -90,7 +90,7 @@
}
//
- PreferencesBuilder builder = new PreferencesBuilder();
+ PortletBuilder builder = new PortletBuilder();
//
ctx.parsePastStartTag(m_uri, m_name);
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -28,10 +28,10 @@
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.gadget.GadgetContentProvider;
import org.exoplatform.portal.pom.spi.gadget.GadgetState;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletContentProvider;
-import org.exoplatform.portal.pom.spi.portlet.PortletPreferenceState;
-import org.exoplatform.portal.pom.spi.portlet.PortletPreferencesState;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.PreferenceState;
+import org.exoplatform.portal.pom.spi.portlet.PortletState;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.pom.spi.wsrp.WSRPContentProvider;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
@@ -187,8 +187,8 @@
builder.add(WorkspaceSpecialization.class);
//
- builder.add(PortletPreferencesState.class);
- builder.add(PortletPreferenceState.class);
+ builder.add(PortletState.class);
+ builder.add(PreferenceState.class);
builder.add(GadgetState.class);
builder.add(WSRPState.class);
@@ -203,7 +203,7 @@
//
ContentManagerRegistry contentManagerRegistry = new
ContentManagerRegistry();
- contentManagerRegistry.register(Preferences.CONTENT_TYPE, new
PortletContentProvider());
+ contentManagerRegistry.register(Portlet.CONTENT_TYPE, new
PortletContentProvider());
contentManagerRegistry.register(Gadget.CONTENT_TYPE, new
GadgetContentProvider());
contentManagerRegistry.register(WSRP.CONTENT_TYPE, new
WSRPContentProvider());
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PortletPreferencesTask.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -24,8 +24,8 @@
import org.exoplatform.portal.pom.data.Mapper;
import org.exoplatform.portal.pom.config.AbstractPOMTask;
import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Page;
@@ -137,8 +137,8 @@
c.destroy();
}
customization =
- page.customize(a, Preferences.CONTENT_TYPE, applicationName +
"/" + portletName,
- new PreferencesBuilder().build());
+ page.customize(a, Portlet.CONTENT_TYPE, applicationName +
"/" + portletName,
+ new PortletBuilder().build());
}
else
{
@@ -148,8 +148,8 @@
c.destroy();
}
customization =
- site.customize(instanceName, Preferences.CONTENT_TYPE,
applicationName + "/" + portletName,
- new PreferencesBuilder().build());
+ site.customize(instanceName, Portlet.CONTENT_TYPE, applicationName +
"/" + portletName,
+ new PortletBuilder().build());
}
}
}
@@ -157,7 +157,7 @@
//
if (customization != null)
{
- PreferencesBuilder builder = new PreferencesBuilder();
+ PortletBuilder builder = new PortletBuilder();
ArrayList<Preference> list = prefs.getPreferences();
if (list != null)
{
@@ -204,33 +204,33 @@
//
if (instanceName != null)
{
- Customization<Preferences> customization;
+ Customization<Portlet> customization;
if (instanceName.startsWith("@"))
{
String id = instanceName.substring(1);
UIWindow window = session.findObjectById(ObjectType.WINDOW, id);
- customization =
(Customization<Preferences>)window.getCustomization();
+ customization = (Customization<Portlet>)window.getCustomization();
}
else
{
int pos = instanceName.indexOf('#');
if (pos == -1)
{
- customization =
(Customization<Preferences>)site.getCustomization(instanceName);
+ customization =
(Customization<Portlet>)site.getCustomization(instanceName);
}
else
{
String a = instanceName.substring(0, pos);
String b = instanceName.substring(pos + 1);
Page page =
site.getRootPage().getChild("pages").getChild(b);
- customization =
(Customization<Preferences>)page.getCustomization(a);
+ customization =
(Customization<Portlet>)page.getCustomization(a);
}
}
//
if (customization != null)
{
- Preferences state = customization.getVirtualState();
+ Portlet state = customization.getVirtualState();
if (state != null)
{
ArrayList<Preference> list = new ArrayList<Preference>();
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -29,7 +29,7 @@
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
@@ -430,14 +430,14 @@
if ("dashboard".equals(type))
{
Site owner = src.getPage().getSite();
- TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>(
+ TransientApplicationState<Portlet> state = new
TransientApplicationState<Portlet>(
"dashboard/DashboardPortlet",
null,
getOwnerType(owner.getObjectType()),
owner.getName(),
null
);
- mo = new ApplicationData<Preferences>(
+ mo = new ApplicationData<Portlet>(
srcContainer.getObjectId(),
component.getName(),
ApplicationType.PORTLET,
Copied:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Portlet.java
(from rev 554,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java)
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Portlet.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Portlet.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -0,0 +1,166 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.spi.portlet;
+
+import org.gatein.mop.api.content.ContentType;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public final class Portlet implements Iterable<Preference>
+{
+
+ /** . */
+ public static final ContentType<Portlet> CONTENT_TYPE = new
ContentType<Portlet>("application/portlet", Portlet.class);
+
+ /** . */
+ final Map<String, Preference> state;
+
+ /** . */
+ private final Map<String, Preference> entries;
+
+ public Portlet()
+ {
+ this.state = new HashMap<String, Preference>();
+ this.entries = Collections.unmodifiableMap(this.state);
+ }
+
+ public Portlet(Map<String, Preference> state)
+ {
+ if (state == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //
+ this.state = new HashMap<String, Preference>(state);
+ this.entries = Collections.unmodifiableMap(this.state);
+ }
+
+ public List<String> getValues(String name)
+ {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.getValues() : null;
+ }
+
+ public Portlet setValues(String name, List<String> values)
+ {
+ Preference entry = entries.get(name);
+ if (entry == null)
+ {
+ entry = new Preference(name, values, false);
+ }
+ else
+ {
+ entry = new Preference(entry.getName(), values, entry.isReadOnly());
+ }
+ entries.put(name, entry);
+ return this;
+ }
+
+ public String getValue(String name)
+ {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.getValue() : null;
+ }
+
+ public Portlet setValue(String name, String value)
+ {
+ Preference entry = entries.get(name);
+ if (entry == null)
+ {
+ entry = new Preference(name, value, false);
+ }
+ else
+ {
+ entry = new Preference(entry.getName(), value, entry.isReadOnly());
+ }
+ state.put(name, entry);
+ return this;
+ }
+
+ public Boolean isReadOnly(String name)
+ {
+ Preference entry = entries.get(name);
+ return entry != null ? entry.isReadOnly() : null;
+ }
+
+ public Portlet setReadOnly(String name, boolean readOnly)
+ {
+ Preference entry = entries.get(name);
+ if (entry == null)
+ {
+ throw new IllegalStateException();
+ }
+ entry = new Preference(entry.getName(), entry.getValues(), readOnly);
+ state.put(name, entry);
+ return this;
+ }
+
+ public Preference getPreference(String name)
+ {
+ return entries.get(name);
+ }
+
+ public Portlet putPreference(Preference preference)
+ {
+ state.put(preference.getName(), preference);
+ return this;
+ }
+
+ public Iterator<Preference> iterator()
+ {
+ return entries.values().iterator();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof Portlet)
+ {
+ Portlet that = (Portlet)obj;
+ return state.equals(that.state);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return state.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Preferences[state=" + state.toString() + "]";
+ }
+}
Copied:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletBuilder.java
(from rev 554,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferencesBuilder.java)
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletBuilder.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletBuilder.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -0,0 +1,105 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.spi.portlet;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class PortletBuilder
+{
+
+ /** The state being configured. */
+ private Portlet prefs;
+
+ public PortletBuilder()
+ {
+ this.prefs = new Portlet();
+ }
+
+ /**
+ * Initialize the builder with the provided preferences.
+ *
+ * @param that the preferences to clone
+ */
+ public PortletBuilder(Portlet that)
+ {
+ Portlet prefs = new Portlet();
+ prefs.state.putAll(that.state);
+
+ //
+ this.prefs = prefs;
+ }
+
+ public PortletBuilder add(Preference preference)
+ {
+ if (preference == null)
+ {
+ throw new NullPointerException();
+ }
+ prefs.state.put(preference.getName(), preference);
+ return this;
+ }
+
+ public PortletBuilder add(String name, List<String> values, boolean readOnly)
+ {
+ return add(new Preference(name, values, readOnly));
+ }
+
+ public PortletBuilder add(String name, List<String> values)
+ {
+ return add(new Preference(name, values, false));
+ }
+
+ public PortletBuilder add(String name, String value, boolean readOnly)
+ {
+ return add(new Preference(name, value, readOnly));
+ }
+
+ public PortletBuilder add(String name, String value)
+ {
+ return add(name, value, false);
+ }
+
+ public PortletBuilder remove(String name)
+ {
+ if (name == null)
+ {
+ throw new NullPointerException();
+ }
+ prefs.state.remove(name);
+ return this;
+ }
+
+ public PortletBuilder clear()
+ {
+ prefs.state.clear();
+ return this;
+ }
+
+ public Portlet build()
+ {
+ Portlet tmp = prefs;
+ prefs = new Portlet();
+ return tmp;
+ }
+}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletContentProvider.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -33,25 +33,25 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class PortletContentProvider implements ContentProvider<Preferences>,
- HelpableContentProvider<PortletPreferencesState, Preferences>
+public class PortletContentProvider implements ContentProvider<Portlet>,
+ HelpableContentProvider<PortletState, Portlet>
{
public PortletContentProvider()
{
}
- public GetState<Preferences> getState(String contentId)
+ public GetState<Portlet> getState(String contentId)
{
throw new UnsupportedOperationException();
}
- public Preferences combine(List<Preferences> states)
+ public Portlet combine(List<Portlet> states)
{
Map<String, Preference> entries = new HashMap<String, Preference>();
//
- for (Preferences preferences : states)
+ for (Portlet preferences : states)
{
for (Preference preference : preferences)
{
@@ -64,36 +64,36 @@
}
//
- return new Preferences(entries);
+ return new Portlet(entries);
}
- public void setState(StateContainer container, Preferences state)
+ public void setState(StateContainer container, Portlet state)
{
ContentProviderHelper.setState(container, state, this);
}
- public Preferences getState(StateContainer container)
+ public Portlet getState(StateContainer container)
{
return ContentProviderHelper.getState(container, this);
}
- public Class<Preferences> getStateType()
+ public Class<Portlet> getStateType()
{
- return Preferences.class;
+ return Portlet.class;
}
public String getNodeName()
{
- return PortletPreferencesState.MOP_NODE_NAME;
+ return PortletState.MOP_NODE_NAME;
}
- public void setInternalState(PortletPreferencesState portletPreferencesState,
Preferences preferences)
+ public void setInternalState(PortletState portletPreferencesState, Portlet
preferences)
{
portletPreferencesState.setPayload(preferences);
}
- public Preferences getState(PortletPreferencesState portletPreferencesState)
+ public Portlet getState(PortletState portletPreferencesState)
{
- return (Preferences)portletPreferencesState.getPayload();
+ return (Portlet)portletPreferencesState.getPayload();
}
}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferenceState.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferenceState.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferenceState.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -1,57 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.spi.portlet;
-
-import org.chromattic.api.annotations.ManyToOne;
-import org.chromattic.api.annotations.Name;
-import org.chromattic.api.annotations.NodeMapping;
-import org.chromattic.api.annotations.Property;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-@NodeMapping(name = "mop:portletpreference")
-public abstract class PortletPreferenceState
-{
-
- @ManyToOne
- public abstract PortletPreferenceState getParent();
-
- @Name
- public abstract String getName();
-
- @Property(name = "value")
- public abstract List<String> getValue();
-
- public abstract void setValue(List<String> value);
-
- @Property(name = "value")
- public abstract List<String> getValues();
-
- public abstract void setValues(List<String> value);
-
- @Property(name = "readonly")
- public abstract boolean getReadOnly();
-
- public abstract void setReadOnly(boolean readOnly);
-}
\ No newline at end of file
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferencesState.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferencesState.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferencesState.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -1,89 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.spi.portlet;
-
-import org.chromattic.api.annotations.Create;
-import org.chromattic.api.annotations.NodeMapping;
-import org.chromattic.api.annotations.OneToMany;
-import org.chromattic.api.annotations.OneToOne;
-import org.chromattic.api.annotations.RelatedMappedBy;
-import org.gatein.mop.core.api.workspace.content.AbstractCustomization;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-@NodeMapping(name = PortletPreferencesState.MOP_NODE_NAME)
-public abstract class PortletPreferencesState
-{
-
- /** . */
- private Preferences payload;
- static final String MOP_NODE_NAME = "mop:portletpreferences";
-
- @OneToMany
- public abstract Map<String, PortletPreferenceState> getChildren();
-
- @Create
- public abstract PortletPreferenceState create();
-
- @OneToOne
- @RelatedMappedBy("state")
- public abstract AbstractCustomization getCustomization();
-
- private void setPayload(Preferences payload)
- {
-
- this.payload = payload;
-
- //
- Map<String, PortletPreferenceState> entries = getChildren();
- entries.clear();
-
- for (Preference pref : payload)
- {
- PortletPreferenceState prefState = create();
- entries.put(pref.getName(), prefState);
- prefState.setValue(pref.getValues());
- prefState.setReadOnly(pref.isReadOnly());
- }
- }
-
- public void setPayload(Object payload)
- {
- setPayload((Preferences)payload);
- }
-
- public Object getPayload()
- {
- if (payload == null)
- {
- PreferencesBuilder builder = new PreferencesBuilder();
- for (PortletPreferenceState entry : getChildren().values())
- {
- builder.add(entry.getName(), entry.getValues(), entry.getReadOnly());
- }
- payload = builder.build();
- }
- return payload;
- }
-}
Copied:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java
(from rev 554,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferencesState.java)
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletState.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -0,0 +1,89 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.spi.portlet;
+
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.OneToMany;
+import org.chromattic.api.annotations.OneToOne;
+import org.chromattic.api.annotations.RelatedMappedBy;
+import org.gatein.mop.core.api.workspace.content.AbstractCustomization;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = PortletState.MOP_NODE_NAME)
+public abstract class PortletState
+{
+
+ /** . */
+ private Portlet payload;
+ static final String MOP_NODE_NAME = "mop:portletpreferences";
+
+ @OneToMany
+ public abstract Map<String, PreferenceState> getChildren();
+
+ @Create
+ public abstract PreferenceState create();
+
+ @OneToOne
+ @RelatedMappedBy("state")
+ public abstract AbstractCustomization getCustomization();
+
+ private void setPayload(Portlet payload)
+ {
+
+ this.payload = payload;
+
+ //
+ Map<String, PreferenceState> entries = getChildren();
+ entries.clear();
+
+ for (Preference pref : payload)
+ {
+ PreferenceState prefState = create();
+ entries.put(pref.getName(), prefState);
+ prefState.setValue(pref.getValues());
+ prefState.setReadOnly(pref.isReadOnly());
+ }
+ }
+
+ public void setPayload(Object payload)
+ {
+ setPayload((Portlet)payload);
+ }
+
+ public Object getPayload()
+ {
+ if (payload == null)
+ {
+ PortletBuilder builder = new PortletBuilder();
+ for (PreferenceState entry : getChildren().values())
+ {
+ builder.add(entry.getName(), entry.getValues(), entry.getReadOnly());
+ }
+ payload = builder.build();
+ }
+ return payload;
+ }
+}
Copied:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferenceState.java
(from rev 554,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PortletPreferenceState.java)
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferenceState.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferenceState.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.spi.portlet;
+
+import org.chromattic.api.annotations.ManyToOne;
+import org.chromattic.api.annotations.Name;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.Property;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "mop:portletpreference")
+public abstract class PreferenceState
+{
+
+ @ManyToOne
+ public abstract PreferenceState getParent();
+
+ @Name
+ public abstract String getName();
+
+ @Property(name = "value")
+ public abstract List<String> getValue();
+
+ public abstract void setValue(List<String> value);
+
+ @Property(name = "value")
+ public abstract List<String> getValues();
+
+ public abstract void setValues(List<String> value);
+
+ @Property(name = "readonly")
+ public abstract boolean getReadOnly();
+
+ public abstract void setReadOnly(boolean readOnly);
+}
\ No newline at end of file
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -1,166 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.spi.portlet;
-
-import org.gatein.mop.api.content.ContentType;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public final class Preferences implements Iterable<Preference>
-{
-
- /** . */
- public static final ContentType<Preferences> CONTENT_TYPE = new
ContentType<Preferences>("application/portlet", Preferences.class);
-
- /** . */
- final Map<String, Preference> state;
-
- /** . */
- private final Map<String, Preference> entries;
-
- public Preferences()
- {
- this.state = new HashMap<String, Preference>();
- this.entries = Collections.unmodifiableMap(this.state);
- }
-
- public Preferences(Map<String, Preference> state)
- {
- if (state == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.state = new HashMap<String, Preference>(state);
- this.entries = Collections.unmodifiableMap(this.state);
- }
-
- public List<String> getValues(String name)
- {
- Preference entry = entries.get(name);
- return entry != null ? entry.getValues() : null;
- }
-
- public Preferences setValues(String name, List<String> values)
- {
- Preference entry = entries.get(name);
- if (entry == null)
- {
- entry = new Preference(name, values, false);
- }
- else
- {
- entry = new Preference(entry.getName(), values, entry.isReadOnly());
- }
- entries.put(name, entry);
- return this;
- }
-
- public String getValue(String name)
- {
- Preference entry = entries.get(name);
- return entry != null ? entry.getValue() : null;
- }
-
- public Preferences setValue(String name, String value)
- {
- Preference entry = entries.get(name);
- if (entry == null)
- {
- entry = new Preference(name, value, false);
- }
- else
- {
- entry = new Preference(entry.getName(), value, entry.isReadOnly());
- }
- state.put(name, entry);
- return this;
- }
-
- public Boolean isReadOnly(String name)
- {
- Preference entry = entries.get(name);
- return entry != null ? entry.isReadOnly() : null;
- }
-
- public Preferences setReadOnly(String name, boolean readOnly)
- {
- Preference entry = entries.get(name);
- if (entry == null)
- {
- throw new IllegalStateException();
- }
- entry = new Preference(entry.getName(), entry.getValues(), readOnly);
- state.put(name, entry);
- return this;
- }
-
- public Preference getPreference(String name)
- {
- return entries.get(name);
- }
-
- public Preferences putPreference(Preference preference)
- {
- state.put(preference.getName(), preference);
- return this;
- }
-
- public Iterator<Preference> iterator()
- {
- return entries.values().iterator();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof Preferences)
- {
- Preferences that = (Preferences)obj;
- return state.equals(that.state);
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return state.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "Preferences[state=" + state.toString() + "]";
- }
-}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferencesBuilder.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferencesBuilder.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/PreferencesBuilder.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -1,105 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.spi.portlet;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class PreferencesBuilder
-{
-
- /** The state being configured. */
- private Preferences prefs;
-
- public PreferencesBuilder()
- {
- this.prefs = new Preferences();
- }
-
- /**
- * Initialize the builder with the provided preferences.
- *
- * @param that the preferences to clone
- */
- public PreferencesBuilder(Preferences that)
- {
- Preferences prefs = new Preferences();
- prefs.state.putAll(that.state);
-
- //
- this.prefs = prefs;
- }
-
- public PreferencesBuilder add(Preference preference)
- {
- if (preference == null)
- {
- throw new NullPointerException();
- }
- prefs.state.put(preference.getName(), preference);
- return this;
- }
-
- public PreferencesBuilder add(String name, List<String> values, boolean
readOnly)
- {
- return add(new Preference(name, values, readOnly));
- }
-
- public PreferencesBuilder add(String name, List<String> values)
- {
- return add(new Preference(name, values, false));
- }
-
- public PreferencesBuilder add(String name, String value, boolean readOnly)
- {
- return add(new Preference(name, value, readOnly));
- }
-
- public PreferencesBuilder add(String name, String value)
- {
- return add(name, value, false);
- }
-
- public PreferencesBuilder remove(String name)
- {
- if (name == null)
- {
- throw new NullPointerException();
- }
- prefs.state.remove(name);
- return this;
- }
-
- public PreferencesBuilder clear()
- {
- prefs.state.clear();
- return this;
- }
-
- public Preferences build()
- {
- Preferences tmp = prefs;
- prefs = new Preferences();
- return tmp;
- }
-}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -22,7 +22,7 @@
import org.exoplatform.portal.pom.registry.CategoryDefinition;
import org.exoplatform.portal.pom.registry.ContentDefinition;
import org.exoplatform.portal.pom.registry.ContentRegistry;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.test.BasicTestCase;
import org.gatein.mop.api.workspace.Workspace;
@@ -77,7 +77,7 @@
POMSession session = POMSessionManager.getSession();
ContentRegistry registry = session.getContentRegistry();
CategoryDefinition category = registry.createCategory("foo");
- ContentDefinition content = category.createContent("bar",
Preferences.CONTENT_TYPE, "myportlet");
+ ContentDefinition content = category.createContent("bar",
Portlet.CONTENT_TYPE, "myportlet");
assertNotNull(content);
// Test that we do have a customization shared at the workspace level
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -36,8 +36,8 @@
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.test.BasicTestCase;
import java.util.ArrayList;
@@ -293,13 +293,13 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>("web/BannerPortlet", new
PreferencesBuilder().add("template", "bar").build());
- Application<Preferences> app = Application.createPortletApplication();
+ TransientApplicationState<Portlet> state = new
TransientApplicationState<Portlet>("web/BannerPortlet", new
PortletBuilder().add("template", "bar").build());
+ Application<Portlet> app = Application.createPortletApplication();
app.setState(state);
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage(page.getPageId());
- app = (Application<Preferences>)page.getChildren().get(0);
+ app = (Application<Portlet>)page.getChildren().get(0);
assertEquals("web/BannerPortlet", storage_.getId(app.getState()));
}
@@ -314,7 +314,7 @@
String app3Id = container.getChildren().get(1).getStorageId();
// Add an application
- Application<Preferences> groovyApp =
create("portal#test:/web/GroovyPortlet/groovyportlet");
+ Application<Portlet> groovyApp =
create("portal#test:/web/GroovyPortlet/groovyportlet");
((Container)page.getChildren().get(1)).getChildren().add(1, groovyApp);
// Save
@@ -375,15 +375,15 @@
// Get cloned page
Page clone = storage_.getPage("portal::test::_test4");
assertEquals(2, clone.getChildren().size());
- Application<Preferences> banner1 =
(Application<Preferences>)clone.getChildren().get(0);
- ApplicationState<Preferences> instanceId = banner1.getState();
+ Application<Portlet> banner1 =
(Application<Portlet>)clone.getChildren().get(0);
+ ApplicationState<Portlet> instanceId = banner1.getState();
// Check instance id format
assertEquals("web/BannerPortlet", storage_.getId(banner1.getState()));
// Check state
- Preferences pagePrefs = storage_.load(instanceId);
- assertEquals(new PreferencesBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
+ Portlet pagePrefs = storage_.load(instanceId);
+ assertEquals(new PortletBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
.build(), pagePrefs);
// Now save the cloned page
@@ -392,7 +392,7 @@
// Get cloned page
clone = storage_.getPage("portal::test::_test4");
assertEquals(2, clone.getChildren().size());
- banner1 = (Application<Preferences>)clone.getChildren().get(0);
+ banner1 = (Application<Portlet>)clone.getChildren().get(0);
instanceId = banner1.getState();
// Check instance id format
@@ -408,7 +408,7 @@
// Check that page prefs have not changed
pagePrefs = storage_.load(instanceId);
- assertEquals(new PreferencesBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
+ assertEquals(new PortletBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
.build(), pagePrefs);
// Update page prefs
@@ -417,7 +417,7 @@
// Check that page prefs have changed
pagePrefs = storage_.load(instanceId);
- assertEquals(new PreferencesBuilder().add("template",
"foo").build(), pagePrefs);
+ assertEquals(new PortletBuilder().add("template",
"foo").build(), pagePrefs);
// Check that site prefs have not changed
sitePrefs =
storage_.getPortletPreferences("portal#test:/web/BannerPortlet/banner");
@@ -442,7 +442,7 @@
//
page = storage_.getPage("portal::test::foo");
assertEquals(1, page.getChildren().size());
- Application<Preferences> dashboardPortlet =
(Application<Preferences>)page.getChildren().get(0);
+ Application<Portlet> dashboardPortlet =
(Application<Portlet>)page.getChildren().get(0);
String dashboardId = dashboardPortlet.getStorageId();
assertNotNull(dashboardId);
assertNotNull(dashboardPortlet.getStorageName());
@@ -450,8 +450,8 @@
// Configures the dashboard
Dashboard dashboard = new Dashboard(dashboardId);
- TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>("foo/bar");
- Application<Preferences> app = Application.createPortletApplication();
+ TransientApplicationState<Portlet> state = new
TransientApplicationState<Portlet>("foo/bar");
+ Application<Portlet> app = Application.createPortletApplication();
app.setState(state);
dashboard.getChildren().add(app);
@@ -466,14 +466,14 @@
// Now check we have the state on the dashboard
dashboard = storage_.loadDashboard(dashboardId);
assertEquals(1, dashboard.getChildren().size());
- app = (Application<Preferences>)dashboard.getChildren().get(0);
+ app = (Application<Portlet>)dashboard.getChildren().get(0);
assertEquals("foo/bar", storage_.getId(app.getState()));
}
public void _testDashboardLayout() throws Exception
{
- Application<Preferences> dashboardPortlet =
Application.createPortletApplication();
- ApplicationState<Preferences> state = new
TransientApplicationState<Preferences>("dashboard/DashboardPortlet");
+ Application<Portlet> dashboardPortlet =
Application.createPortletApplication();
+ ApplicationState<Portlet> state = new
TransientApplicationState<Portlet>("dashboard/DashboardPortlet");
dashboardPortlet.setState(state);
//
@@ -502,8 +502,8 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- Application<Preferences> app = Application.createPortletApplication();
- app.setState(new
TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
+ Application<Portlet> app = Application.createPortletApplication();
+ app.setState(new
TransientApplicationState<Portlet>("dashboard/DashboardPortlet"));
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage("portal::test::foo");
@@ -546,8 +546,8 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- Application<Preferences> app = Application.createPortletApplication();
- app.setState(new
TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
+ Application<Portlet> app = Application.createPortletApplication();
+ app.setState(new
TransientApplicationState<Portlet>("dashboard/DashboardPortlet"));
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage("portal::test::foo");
@@ -586,7 +586,7 @@
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
- private Application<Preferences> create(String instanceId)
+ private Application<Portlet> create(String instanceId)
{
int i0 = instanceId.indexOf("#");
int i1 = instanceId.indexOf(":/", i0 + 1);
@@ -594,13 +594,13 @@
String ownerId = instanceId.substring(i0 + 1, i1);
String persistenceid = instanceId.substring(i1 + 2);
String[] persistenceChunks = split("/", persistenceid);
- TransientApplicationState<Preferences> state = new
TransientApplicationState<Preferences>(
+ TransientApplicationState<Portlet> state = new
TransientApplicationState<Portlet>(
persistenceChunks[0] + "/" + persistenceChunks[1],
null,
ownerType,
ownerId,
persistenceChunks[2]);
- Application<Preferences> portletApp =
Application.createPortletApplication();
+ Application<Portlet> portletApp = Application.createPortletApplication();
portletApp.setState(state);
return portletApp;
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -26,8 +26,8 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.Page.PageSet;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.test.BasicTestCase;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
@@ -110,13 +110,13 @@
{
IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
- Application<Preferences> app =
- (Application<Preferences>)uctx.unmarshalDocument(new FileInputStream(
+ Application<Portlet> app =
+ (Application<Portlet>)uctx.unmarshalDocument(new FileInputStream(
"src/test/resources/jibx/portlet-application.xml"), null);
TransientApplicationState portletState =
(TransientApplicationState)app.getState();
assertNotNull(portletState);
assertEquals("web/BannerPortlet", portletState.getContentId());
- Preferences preferences = (Preferences)portletState.getContentState();
- assertEquals(new PreferencesBuilder().add("template",
"template_value").build(), preferences);
+ Portlet preferences = (Portlet)portletState.getContentState();
+ assertEquals(new PortletBuilder().add("template",
"template_value").build(), preferences);
}
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -24,8 +24,8 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.test.BasicTestCase;
/**
@@ -65,12 +65,12 @@
public void testSiteScopedPreferences() throws Exception
{
Page page = storage_.getPage("portal::test::test4");
- Application<Preferences> app =
(Application<Preferences>)page.getChildren().get(0);
- PersistentApplicationState<Preferences> state =
(PersistentApplicationState)app.getState();
+ Application<Portlet> app =
(Application<Portlet>)page.getChildren().get(0);
+ PersistentApplicationState<Portlet> state =
(PersistentApplicationState)app.getState();
//
- Preferences prefs = storage_.load(state);
- assertEquals(new PreferencesBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
+ Portlet prefs = storage_.load(state);
+ assertEquals(new PortletBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl")
.build(), prefs);
//
@@ -80,6 +80,6 @@
//
prefs = storage_.load(state);
assertNotNull(prefs);
- assertEquals(new PreferencesBuilder().add("template",
"someanothervalue").build(), prefs);
+ assertEquals(new PortletBuilder().add("template",
"someanothervalue").build(), prefs);
}
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -33,8 +33,8 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.services.listener.Event;
import org.exoplatform.services.listener.Listener;
import org.exoplatform.services.listener.ListenerService;
@@ -608,9 +608,9 @@
assertEquals("test5", clone.getName());
//
- Application<Preferences> app =
(Application<Preferences>)clone.getChildren().get(0);
- Preferences prefs2 = storage_.load(app.getState());
- assertEquals(new PreferencesBuilder().add("template",
+ Application<Portlet> app =
(Application<Portlet>)clone.getChildren().get(0);
+ Portlet prefs2 = storage_.load(app.getState());
+ assertEquals(new PortletBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
// Update prefs of original page
@@ -620,7 +620,7 @@
//
prefs2 = storage_.load(app.getState());
- assertEquals(new PreferencesBuilder().add("template",
+ assertEquals(new PortletBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
}
}.execute(null);
@@ -641,13 +641,13 @@
assertEquals(1, clone.getChildren().size());
//
- Application<Preferences> app =
(Application<Preferences>)clone.getChildren().get(0);
+ Application<Portlet> app =
(Application<Portlet>)clone.getChildren().get(0);
assertEquals("Dashboard", app.getTitle());
assertNotNull(app.getState());
assertEquals("dashboard/DashboardPortlet",
storage_.getId(app.getState()));
// assertEquals("portal",
app.getInstanceState().getOwnerType());
// assertEquals("test",
app.getInstanceState().getOwnerId());
- Preferences prefs2 = storage_.load(app.getState());
+ Portlet prefs2 = storage_.load(app.getState());
assertNull(prefs2);
}
}.execute(null);
@@ -666,7 +666,7 @@
assertEquals(2, container.getChildren().size());
assertTrue(container.getChildren().get(0) instanceof PageBody);
assertTrue(((Application)container.getChildren().get(1)).getType() ==
ApplicationType.PORTLET);
- Application<Preferences> pa =
(Application<Preferences>)container.getChildren().get(1);
+ Application<Portlet> pa =
(Application<Portlet>)container.getChildren().get(1);
ApplicationState state = pa.getState();
assertEquals("overwrite_application_ref/overwrite_portlet_ref",
storage_.getId(pa.getState()));
}
@@ -699,7 +699,7 @@
assertEquals(2, container.getChildren().size());
assertTrue(container.getChildren().get(0) instanceof PageBody);
assertTrue(((Application)container.getChildren().get(1)).getType() ==
ApplicationType.PORTLET);
- Application<Preferences> pa =
(Application<Preferences>)container.getChildren().get(1);
+ Application<Portlet> pa =
(Application<Portlet>)container.getChildren().get(1);
ApplicationState state = pa.getState();
assertEquals("foo/bar", storage_.getId(pa.getState()));
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -30,9 +30,9 @@
import org.exoplatform.portal.pc.ExoPortletStateType;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.portal.pom.spi.portlet.Preference;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.pom.spi.wsrp.WSRPPortletStateType;
import org.exoplatform.web.application.gadget.GadgetApplication;
@@ -76,14 +76,14 @@
}
/** . */
- private static final ModelAdapter<Preferences, ExoPortletState> PORTLET = new
ModelAdapter<Preferences, ExoPortletState>()
+ private static final ModelAdapter<Portlet, ExoPortletState> PORTLET = new
ModelAdapter<Portlet, ExoPortletState>()
{
@Override
- public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer
container, String applicationId, ApplicationState<Preferences> applicationState)
throws Exception
+ public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer
container, String applicationId, ApplicationState<Portlet> applicationState) throws
Exception
{
DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- Preferences preferences = dataStorage.load(applicationState);
+ Portlet preferences = dataStorage.load(applicationState);
PortletContext producerOfferedPortletContext =
getProducerOfferedPortletContext(applicationId);
ExoPortletState map = new
ExoPortletState(producerOfferedPortletContext.getId());
if (preferences != null)
@@ -97,10 +97,10 @@
}
@Override
- public ApplicationState<Preferences> update(ExoContainer container,
ExoPortletState updateState, ApplicationState<Preferences> applicationState) throws
Exception
+ public ApplicationState<Portlet> update(ExoContainer container,
ExoPortletState updateState, ApplicationState<Portlet> applicationState) throws
Exception
{
// Compute new preferences
- PreferencesBuilder builder = new PreferencesBuilder();
+ PortletBuilder builder = new PortletBuilder();
for (Map.Entry<String, List<String>> entry :
updateState.getState().entrySet())
{
builder.add(entry.getKey(), entry.getValue());
@@ -108,13 +108,13 @@
if (applicationState instanceof TransientApplicationState)
{
- TransientApplicationState<Preferences> transientState =
(TransientApplicationState<Preferences>)applicationState;
+ TransientApplicationState<Portlet> transientState =
(TransientApplicationState<Portlet>)applicationState;
transientState.setContentState(builder.build());
return transientState;
}
else
{
- PersistentApplicationState<Preferences> persistentState =
(PersistentApplicationState<Preferences>)applicationState;
+ PersistentApplicationState<Portlet> persistentState =
(PersistentApplicationState<Portlet>)applicationState;
DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
return dataStorage.save(persistentState, builder.build());
}
@@ -130,18 +130,18 @@
}
@Override
- public Preferences getState(ExoContainer container,
ApplicationState<Preferences> applicationState) throws Exception
+ public Portlet getState(ExoContainer container, ApplicationState<Portlet>
applicationState) throws Exception
{
if (applicationState instanceof TransientApplicationState)
{
- TransientApplicationState<Preferences> transientState =
(TransientApplicationState<Preferences>)applicationState;
- Preferences pref = transientState.getContentState();
- if(pref == null) pref = new Preferences();
+ TransientApplicationState<Portlet> transientState =
(TransientApplicationState<Portlet>)applicationState;
+ Portlet pref = transientState.getContentState();
+ if(pref == null) pref = new Portlet();
return pref;
}
else
{
- PersistentApplicationState<Preferences> persistentState =
(PersistentApplicationState<Preferences>)applicationState;
+ PersistentApplicationState<Portlet> persistentState =
(PersistentApplicationState<Portlet>)applicationState;
DataStorage dataStorage =
(DataStorage)container.getComponentInstanceOfType(DataStorage.class);
return dataStorage.load(persistentState);
}
@@ -182,7 +182,7 @@
}
@Override
- public Preferences getState(ExoContainer container, ApplicationState<Gadget>
applicationState) throws Exception
+ public Portlet getState(ExoContainer container, ApplicationState<Gadget>
applicationState) throws Exception
{
// For now we return null as it does not make sense to edit the gadget
preferences
return null;
@@ -193,7 +193,7 @@
private static final ModelAdapter<WSRP, WSRP> WSRP = new ModelAdapter<WSRP,
WSRP>()
{
@Override
- public Preferences getState(ExoContainer container, ApplicationState<WSRP>
state) throws Exception
+ public Portlet getState(ExoContainer container, ApplicationState<WSRP> state)
throws Exception
{
return null; // return null for now
}
@@ -249,6 +249,6 @@
* @return the preferences
* @throws Exception any exception
*/
- public abstract Preferences getState(ExoContainer container, ApplicationState<S>
applicationState) throws Exception;
+ public abstract Portlet getState(ExoContainer container, ApplicationState<S>
applicationState) throws Exception;
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -32,7 +32,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRPState;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -205,7 +205,7 @@
Object appId;
if (!remote)
{
- appState = new
CloneApplicationState<Preferences>(application.getId());
+ appState = new CloneApplicationState<Portlet>(application.getId());
}
else
{
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -25,7 +25,7 @@
import org.exoplatform.portal.application.UserProfileLifecycle;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import
org.exoplatform.portal.webui.application.UIPortletActionListener.ChangePortletModeActionListener;
import
org.exoplatform.portal.webui.application.UIPortletActionListener.ChangeWindowStateActionListener;
@@ -49,7 +49,6 @@
import org.gatein.common.i18n.LocalizedString;
import org.gatein.common.net.media.MediaType;
import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletInvokerException;
@@ -126,7 +125,7 @@
private ModelAdapter<S, C> adapter;
/** . */
- private Portlet producedOfferedPortlet;
+ private org.gatein.pc.api.Portlet producedOfferedPortlet;
/** . */
private PortletContext producerOfferedPortletContext;
@@ -370,7 +369,7 @@
{
if (displayName == null)
{
- Portlet portlet = getProducedOfferedPortlet();
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
if (portlet != null)
{
PortletInfo info = portlet.getInfo();
@@ -405,7 +404,7 @@
}
if (value == null || value.length() == 0)
{
- Portlet portlet = getProducedOfferedPortlet();
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
PortletInfo info = portlet.getInfo();
value = info.getName();
}
@@ -413,7 +412,7 @@
}
}
- public Portlet getProducedOfferedPortlet()
+ public org.gatein.pc.api.Portlet getProducedOfferedPortlet()
{
return producedOfferedPortlet;
}
@@ -427,7 +426,7 @@
List<String> supportModes = new ArrayList<String>();
- Portlet portlet = getProducedOfferedPortlet();
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
// if we couldn't get the portlet that just return an empty modes list
if (portlet == null)
@@ -467,7 +466,7 @@
if (supportedProcessingEvents_ == null)
{
- Portlet portlet = getProducedOfferedPortlet();
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
if (portlet == null)
{
@@ -756,7 +755,7 @@
String applicationId = dataStorage.getId(state.getApplicationState());
ModelAdapter<S, C> adapter =
ModelAdapter.getAdapter(state.getApplicationType());
PortletContext producerOfferedPortletContext =
adapter.getProducerOfferedPortletContext(applicationId);
- Portlet producedOfferedPortlet =
portletInvoker.getPortlet(producerOfferedPortletContext);
+ org.gatein.pc.api.Portlet producedOfferedPortlet =
portletInvoker.getPortlet(producerOfferedPortletContext);
this.adapter = adapter;
this.producerOfferedPortletContext = producerOfferedPortletContext;
@@ -784,7 +783,7 @@
* @return the preferences of the portlet
* @throws Exception any exception
*/
- public Preferences getPreferences() throws Exception
+ public Portlet getPreferences() throws Exception
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
ExoContainer container =
context.getApplication().getApplicationServiceContainer();
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2009-11-11
00:33:06 UTC (rev 556)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2009-11-11
00:42:33 UTC (rev 557)
@@ -23,7 +23,7 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.pc.ExoPortletState;
import org.exoplatform.portal.pom.spi.portlet.Preference;
-import org.exoplatform.portal.pom.spi.portlet.Preferences;
+import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.pom.spi.wsrp.WSRPPortletStateType;
import org.exoplatform.portal.portlet.PortletExceptionHandleService;
@@ -277,7 +277,7 @@
{
//
- Preferences pp = uiPortlet.getPreferences();
+ Portlet pp = uiPortlet.getPreferences();
if (pp != null)
{
UIFormInputSet uiPortletPrefSet = getChildById(FIELD_PORTLET_PREF);