gatein SVN: r559 - in portal/trunk: web/portal/src/main/webapp/groovy/portal/webui/portal and 4 other directories.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2009-11-11 02:42:29 -0500 (Wed, 11 Nov 2009)
New Revision: 559
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIWizard.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
Log:
GTNPORTAL-42 The Page Editor popup is closed when creating a new page
Comment: Move action buttons into Composer
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-11-11 07:42:29 UTC (rev 559)
@@ -56,6 +56,16 @@
background: url('background/TopExitBtn.gif') no-repeat right bottom;
}
+.UIPopupWindow .BackButton {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ margin: 5px 3px 0px 0px; /* orientation=lt */
+ margin: 5px 0px 0px 3px; /* orientation=rt */
+ cursor: pointer;
+ width: 18px; height: 18px;
+ background: url('background/BackBtn.gif') no-repeat right bottom;
+}
+
.UIPopupWindow .TopLeftCornerDecorator {
background: url('background/TopPopup.png') no-repeat left top;
padding-left: 8px;
@@ -190,6 +200,14 @@
width: 25px;
}
+.UIPortalComposer .BackButton {
+ background: #666666 no-repeat scroll right bottom; /* orientation=lt */
+ background: #666666 no-repeat scroll left bottom; /* orientation=rt */
+ width: 25px;
+ height: 17px;
+ margin: 6px 0px 0px 0px;
+}
+
.UIPortalComposer .EdittedSaveButton {
background: transparent url(background/SaveIcon.gif) no-repeat scroll right bottom; /* orientation=lt */
background: transparent url(background/SaveIcon-rt.gif) no-repeat scroll left bottom; /* orientation=rt */
Modified: portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2009-11-11 07:42:29 UTC (rev 559)
@@ -16,6 +16,11 @@
<% if(uicomponent.isShowControl) { %>
<a class="CloseButton" title="<%=_ctx.appRes(popupId + ".action.Abort")%>" href="<%=uicomponent.event("Abort")%>"><span></span></a>
<a class="<%= isEditted ? "EdittedSaveButton" : "SaveButton" %>" title="<%=_ctx.appRes(popupId + ".action.Finish")%>" href="<%=uicomponent.event("Finish")%>"><span></span></a>
+ <% if (uicomponent.isUsedInWizard()) { %>
+ <a class="BackButton"" title="<%=_ctx.appRes(popupId + ".action.Back")%>" href="<%=uicomponent.event("Back")%>">
+ <span></span>
+ </a>
+ <% } %>
<% } %>
<div class="PopupTitle"><%=_ctx.appRes(popupId + ".title."+ popupId)%></div>
</div>
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIWizard.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIWizard.gtmpl 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIWizard.gtmpl 2009-11-11 07:42:29 UTC (rev 559)
@@ -57,7 +57,7 @@
<table class="ActionContainer">
<tr>
<td>
-
+ <% if (uicomponent.isShowActions()) { %>
<div onclick="<%=uicomponent.event("Abort", "");%>" class="ActionButton LightBlueStyle">
<div class="ButtonLeft">
<div class="ButtonRight">
@@ -103,8 +103,10 @@
</div>
</div>
</div>
- <% } %>
-
+ <% } %>
+
+
+ <%} // End if (step != 3)%>
</td>
</tr>
</table>
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-11-11 07:42:29 UTC (rev 559)
@@ -42,7 +42,6 @@
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -182,6 +181,8 @@
uiWizard.updateWizardComponent();
uiWizard.viewStep(FIRST_STEP);
+
+ uiWizard.setShowActions(true);
UIWorkingWorkspace uiWorkingWS = uiWizard.getAncestorOfType(UIWorkingWorkspace.class);
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
@@ -193,6 +194,7 @@
public void execute(Event<UIPageCreationWizard> event) throws Exception
{
UIPageCreationWizard uiWizard = event.getSource();
+ uiWizard.setShowActions(true);
UIPortalApplication uiPortalApp = uiWizard.getAncestorOfType(UIPortalApplication.class);
UIWorkingWorkspace uiWorkingWS = uiWizard.getAncestorOfType(UIWorkingWorkspace.class);
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
@@ -268,6 +270,7 @@
public void execute(Event<UIPageCreationWizard> event) throws Exception
{
UIPageCreationWizard uiWizard = event.getSource();
+ uiWizard.setShowActions(false);
UIPortalApplication uiPortalApp = uiWizard.getAncestorOfType(UIPortalApplication.class);
UIWorkingWorkspace uiWorkingWS = uiWizard.getAncestorOfType(UIWorkingWorkspace.class);
WebuiRequestContext context = Util.getPortalRequestContext();
@@ -360,6 +363,7 @@
public void execute(Event<UIPageCreationWizard> event) throws Exception
{
UIPageCreationWizard uiWizard = event.getSource();
+ uiWizard.setShowActions(true);
UIPortalApplication uiPortalApp = uiWizard.getAncestorOfType(UIPortalApplication.class);
UIWorkingWorkspace uiWorkingWS = uiWizard.getAncestorOfType(UIWorkingWorkspace.class);
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2009-11-11 07:42:29 UTC (rev 559)
@@ -42,6 +42,8 @@
private int numberStep_;
private boolean showWelcome = true;
+
+ private boolean showActions = true;
public UIPageWizard() throws Exception
{
@@ -61,6 +63,16 @@
return numberStep_;
}
+ public boolean isShowActions()
+ {
+ return showActions;
+ }
+
+ public void setShowActions(boolean showActions)
+ {
+ this.showActions = showActions;
+ }
+
public void processRender(WebuiRequestContext context) throws Exception
{
super.processRender(context);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-11-11 07:42:29 UTC (rev 559)
@@ -52,8 +52,10 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UITabPane;
+import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.event.Event.Phase;
import java.util.List;
@@ -70,6 +72,7 @@
@EventConfig(name = "ViewProperties", listeners = UIPortalComposer.ViewProperties2ActionListener.class),
@EventConfig(name = "Abort", listeners = UIPortalComposer.Abort2ActionListener.class),
@EventConfig(name = "Finish", listeners = UIPortalComposer.Finish2ActionListener.class),
+ @EventConfig(name = "Back", listeners = UIPortalComposer.BackActionListener.class),
@EventConfig(listeners = UIPortalComposer.SwitchModeActionListener.class),
@EventConfig(listeners = UIPortalComposer.ChangeEdittedStateActionListener.class),
@EventConfig(listeners = UIPortalComposer.ToggleActionListener.class)}),
@@ -135,6 +138,18 @@
isShowControl = state;
}
+ public boolean isUsedInWizard()
+ {
+ UIWorkingWorkspace uiWorkingWS = getAncestorOfType(UIWorkingWorkspace.class);
+ UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
+ UIComponent uicomponent = uiToolPanel.getUIComponent();
+ if (uicomponent != null && uicomponent instanceof UIWizard)
+ {
+ return true;
+ }
+ return false;
+ }
+
public void save() throws Exception
{
PortalRequestContext prContext = Util.getPortalRequestContext();
@@ -426,19 +441,19 @@
switch (portalMode)
{
- case UIPortalApplication.APP_BLOCK_EDIT_MODE:
+ case UIPortalApplication.APP_BLOCK_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.APP_VIEW_EDIT_MODE);
break;
- case UIPortalApplication.APP_VIEW_EDIT_MODE:
+ case UIPortalApplication.APP_VIEW_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
break;
- case UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE:
+ case UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_VIEW_EDIT_MODE);
break;
- case UIPortalApplication.CONTAINER_VIEW_EDIT_MODE:
+ case UIPortalApplication.CONTAINER_VIEW_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE);
break;
- default:
+ default :
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
return;
}
@@ -522,6 +537,14 @@
UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
UIPortalComposer composer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
composer.setEditted(false);
+ if (composer.isUsedInWizard()) {
+ UIWizard wizard = (UIWizard)uiToolPanel.getUIComponent();
+ int step = wizard.getCurrentStep();
+ step ++;
+ Event<UIComponent> uiEvent = wizard.createEvent("ViewStep" + step, Phase.PROCESS, event.getRequestContext());
+ uiEvent.broadcast();
+ return;
+ }
UIPage uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
//
@@ -552,4 +575,21 @@
jsManager.addJavascript("eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
}
}
+
+ static public class BackActionListener extends EventListener<UIPortalComposer>
+ {
+ public void execute(Event<UIPortalComposer> event) throws Exception
+ {
+ UIPortalComposer composer = event.getSource();
+ if (composer.isUsedInWizard()) {
+ UIWorkingWorkspace uiWorkingWS = composer.getAncestorOfType(UIWorkingWorkspace.class);
+ UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
+ UIWizard wizard = (UIWizard)uiToolPanel.getUIComponent();
+ int step = wizard.getCurrentStep();
+ step --;
+ Event<UIComponent> uiEvent = wizard.createEvent("ViewStep" + step, Phase.PROCESS, event.getRequestContext());
+ uiEvent.broadcast();
+ }
+ }
+ }
}
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2009-11-11 03:03:45 UTC (rev 558)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2009-11-11 07:42:29 UTC (rev 559)
@@ -103,9 +103,9 @@
portalComposer.setRendered(false);
portalComposer.setComponentConfig(UIPortalComposer.class, "UIPageEditor");
portalComposer.setId("UIPageEditor");
- portalComposer.setShowControl(false);
- portalComposer.setEditted(false);
- portalComposer.setCollapse(true);
+ portalComposer.setShowControl(true);
+ portalComposer.setEditted(true);
+ portalComposer.setCollapse(false);
UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
uiToolPanel.setShowMaskLayer(false);
15 years, 2 months
gatein SVN: r558 - portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2009-11-10 22:03:45 -0500 (Tue, 10 Nov 2009)
New Revision: 558
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-172 There is an exception when click Portal properties in special case (Re-opened)
(Fix after merge branches source code)
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:42:33 UTC (rev 557)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-11 03:03:45 UTC (rev 558)
@@ -546,23 +546,20 @@
private void build(ContainerData parent, Map<String, String> hierarchyRelationships)
{
String parentId = parent.getStorageId();
- if (parentId != null)
+ for (ModelData child : parent.getChildren())
{
- for (ModelData child : parent.getChildren())
+ String childId = child.getStorageId();
+ if (childId != null)
{
- String childId = child.getStorageId();
- if (childId != null)
+ if (hierarchyRelationships.put(childId, parentId) != null)
{
- if (hierarchyRelationships.put(childId, parentId) != null)
- {
- throw new AssertionError("The same object is present two times in the object hierarchy");
- }
- if (child instanceof ContainerData)
- {
- build((ContainerData)child, hierarchyRelationships);
- }
- }
+ throw new AssertionError("The same object is present two times in the object hierarchy");
+ }
}
+ if (child instanceof ContainerData)
+ {
+ build((ContainerData)child, hierarchyRelationships);
+ }
}
}
15 years, 2 months
gatein SVN: r557 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/config/model and 7 other directories.
by do-not-reply@jboss.org
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);
15 years, 2 months
gatein SVN: r556 - portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-10 19:33:06 -0500 (Tue, 10 Nov 2009)
New Revision: 556
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java
Log:
forgot to commit one class
Added: 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 (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/PortletApplication.java 2009-11-11 00:33:06 UTC (rev 556)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2007 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.portal.config.serialize;
+
+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;
+
+/**
+ * We keep that subclass here to please JiBX crap.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletApplication extends Application<Preferences>
+{
+
+ public PortletApplication(ApplicationData<Preferences> preferencesApplicationData)
+ {
+ super(preferencesApplicationData);
+ }
+
+ public PortletApplication(ApplicationType<Preferences> preferencesApplicationType, String storageId)
+ {
+ super(preferencesApplicationType, storageId);
+ }
+
+ public PortletApplication(ApplicationType<Preferences> preferencesApplicationType)
+ {
+ super(preferencesApplicationType);
+ }
+}
15 years, 2 months
gatein SVN: r555 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/config/serialize and 3 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-10 19:30:04 -0500 (Tue, 10 Nov 2009)
New Revision: 555
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/
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/ModelObject.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java
portal/trunk/component/portal/src/main/resources/binding.xml
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.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/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
removed Application subclasses that were not anymore a necessity
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -22,6 +22,9 @@
import org.exoplatform.portal.pom.config.Utils;
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.wsrp.WSRP;
/**
* May 13, 2004
@@ -29,7 +32,7 @@
* @email: tuan08(a)users.sourceforge.net
* @version: $Id: Portlet.java,v 1.7 2004/09/30 01:00:05 tuan08 Exp $
**/
-public abstract class Application<S> extends ModelObject
+public class Application<S> extends ModelObject
{
/** The application state. */
@@ -61,6 +64,9 @@
private boolean isModifiable;
+ /** We cannot allow the type to change once the object is created. */
+ private final ApplicationType<S> type;
+
public Application(ApplicationData<S> data)
{
super(data.getStorageId());
@@ -83,19 +89,29 @@
this.height = data.getHeight();
this.properties = new Properties(data.getProperties());
this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
+ this.type = data.getType();
}
- public Application(String storageId)
+ public Application(ApplicationType<S> type, String storageId)
{
super(storageId);
+
+ //
+ this.type = type;
}
- public Application()
+ public Application(ApplicationType<S> type)
{
super();
+
+ //
+ this.type = type;
}
- public abstract ApplicationType<S> getType();
+ public ApplicationType<S> getType()
+ {
+ return type;
+ }
public String getWidth()
{
@@ -261,4 +277,49 @@
Utils.safeImmutableList(accessPermissions)
);
}
+
+ public static Application<Gadget> createGadgetApplication(ApplicationData<Gadget> data)
+ {
+ return new Application<Gadget>(data);
+ }
+
+ public static Application<Gadget> createGadgetApplication(String storageId)
+ {
+ return new Application<Gadget>(ApplicationType.GADGET, storageId);
+ }
+
+ public static Application<Gadget> createGadgetApplication()
+ {
+ return new Application<Gadget>(ApplicationType.GADGET);
+ }
+
+ public static Application<Preferences> createPortletApplication(ApplicationData<Preferences> data)
+ {
+ return new Application<Preferences>(data);
+ }
+
+ public static Application<Preferences> createPortletApplication(String storageId)
+ {
+ return new Application<Preferences>(ApplicationType.PORTLET, storageId);
+ }
+
+ public static Application<Preferences> createPortletApplication()
+ {
+ return new Application<Preferences>(ApplicationType.PORTLET);
+ }
+
+ public static Application<WSRP> createWSRPApplication(ApplicationData<WSRP> wsrpwsrpIdApplicationData)
+ {
+ return new Application<WSRP>(wsrpwsrpIdApplicationData);
+ }
+
+ public static Application<WSRP> createWSRPApplication()
+ {
+ return new Application<WSRP>(ApplicationType.WSRP_PORTLET);
+ }
+
+ public static Application<WSRP> createWSRPApplication(String storageId)
+ {
+ return new Application<WSRP>(ApplicationType.WSRP_PORTLET, storageId);
+ }
}
\ No newline at end of file
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -19,9 +19,6 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.pom.data.BodyData;
import org.exoplatform.portal.pom.data.ContainerData;
@@ -105,15 +102,15 @@
ApplicationType type = applicationData.getType();
if (ApplicationType.PORTLET == type)
{
- return new PortletApplication((ApplicationData<Preferences>)applicationData);
+ return Application.createPortletApplication((ApplicationData<Preferences>)applicationData);
}
else if (ApplicationType.GADGET == type)
{
- return new GadgetApplication((ApplicationData<Gadget>)applicationData);
+ return Application.createGadgetApplication((ApplicationData<Gadget>)applicationData);
}
else if (ApplicationType.WSRP_PORTLET == type)
{
- return new WSRPApplication((ApplicationData<WSRP>)applicationData);
+ return Application.createWSRPApplication((ApplicationData<WSRP>)applicationData);
}
else
{
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -23,9 +23,9 @@
import org.exoplatform.portal.application.Preference;
import org.exoplatform.portal.config.NewPortalConfigListener;
+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.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
import org.jibx.runtime.IAliasable;
@@ -100,7 +100,7 @@
ctx.parsePastStartTag(m_uri, m_name);
//
- PortletApplication app;
+ Application<Preferences> app;
if ("application".equals(m_name))
{
String instanceId = ctx.parseElementText(m_uri, "instance-id");
@@ -130,7 +130,7 @@
ownerId,
persistenceChunks[2]);
}
- app = new PortletApplication();
+ app = Application.createPortletApplication();
app.setState(state);
}
else
@@ -155,7 +155,7 @@
{
state = new TransientApplicationState<Preferences>(applicationName + "/" + portletName, null);
}
- app = new PortletApplication();
+ app = Application.createPortletApplication();
app.setState(state);
ctx.parsePastEndTag(m_uri, "portlet");
}
Modified: portal/trunk/component/portal/src/main/resources/binding.xml
===================================================================
--- portal/trunk/component/portal/src/main/resources/binding.xml 2009-11-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/main/resources/binding.xml 2009-11-11 00:30:04 UTC (rev 555)
@@ -60,7 +60,7 @@
<mapping name="portlet-application"
label="portlet-application"
- class="org.exoplatform.portal.config.model.portlet.PortletApplication"
+ class="org.exoplatform.portal.config.serialize.PortletApplication"
marshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler"
unmarshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler">
<!--
@@ -129,7 +129,7 @@
<structure map-as="org.exoplatform.portal.config.model.Application" usage="optional"/>
<structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
<structure map-as="org.exoplatform.portal.config.model.SiteBody" usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.portlet.PortletApplication" usage="optional"/>
+ <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
</collection>
</mapping>
@@ -149,7 +149,7 @@
<structure map-as="org.exoplatform.portal.config.model.Container" usage="optional"/>
<structure map-as="org.exoplatform.portal.config.model.Application" usage="optional"/>
<structure map-as="org.exoplatform.portal.config.model.PageBody" usage="optional"/>
- <structure map-as="org.exoplatform.portal.config.model.portlet.PortletApplication" usage="optional"/>
+ <structure map-as="org.exoplatform.portal.config.serialize.PortletApplication" usage="optional"/>
</collection>
</mapping>
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -26,6 +26,7 @@
import org.exoplatform.portal.application.Preference;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -33,8 +34,6 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -295,12 +294,12 @@
Page page = new Page();
page.setPageId("portal::test::foo");
TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>("web/BannerPortlet", new PreferencesBuilder().add("template", "bar").build());
- PortletApplication app = new PortletApplication();
+ Application<Preferences> app = Application.createPortletApplication();
app.setState(state);
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage(page.getPageId());
- app = (PortletApplication)page.getChildren().get(0);
+ app = (Application<Preferences>)page.getChildren().get(0);
assertEquals("web/BannerPortlet", storage_.getId(app.getState()));
}
@@ -315,7 +314,7 @@
String app3Id = container.getChildren().get(1).getStorageId();
// Add an application
- PortletApplication groovyApp = create("portal#test:/web/GroovyPortlet/groovyportlet");
+ Application<Preferences> groovyApp = create("portal#test:/web/GroovyPortlet/groovyportlet");
((Container)page.getChildren().get(1)).getChildren().add(1, groovyApp);
// Save
@@ -376,7 +375,7 @@
// Get cloned page
Page clone = storage_.getPage("portal::test::_test4");
assertEquals(2, clone.getChildren().size());
- PortletApplication banner1 = (PortletApplication)clone.getChildren().get(0);
+ Application<Preferences> banner1 = (Application<Preferences>)clone.getChildren().get(0);
ApplicationState<Preferences> instanceId = banner1.getState();
// Check instance id format
@@ -393,7 +392,7 @@
// Get cloned page
clone = storage_.getPage("portal::test::_test4");
assertEquals(2, clone.getChildren().size());
- banner1 = (PortletApplication)clone.getChildren().get(0);
+ banner1 = (Application<Preferences>)clone.getChildren().get(0);
instanceId = banner1.getState();
// Check instance id format
@@ -443,7 +442,7 @@
//
page = storage_.getPage("portal::test::foo");
assertEquals(1, page.getChildren().size());
- PortletApplication dashboardPortlet = (PortletApplication)page.getChildren().get(0);
+ Application<Preferences> dashboardPortlet = (Application<Preferences>)page.getChildren().get(0);
String dashboardId = dashboardPortlet.getStorageId();
assertNotNull(dashboardId);
assertNotNull(dashboardPortlet.getStorageName());
@@ -452,7 +451,7 @@
// Configures the dashboard
Dashboard dashboard = new Dashboard(dashboardId);
TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>("foo/bar");
- PortletApplication app = new PortletApplication();
+ Application<Preferences> app = Application.createPortletApplication();
app.setState(state);
dashboard.getChildren().add(app);
@@ -462,18 +461,18 @@
// Test that load page does not load the children
page = storage_.getPage("portal::test::foo");
assertEquals(1, page.getChildren().size());
- assertTrue(page.getChildren().get(0) instanceof PortletApplication);
+ assertTrue(((Application)page.getChildren().get(0)).getType() == ApplicationType.PORTLET);
// Now check we have the state on the dashboard
dashboard = storage_.loadDashboard(dashboardId);
assertEquals(1, dashboard.getChildren().size());
- app = (PortletApplication)dashboard.getChildren().get(0);
+ app = (Application<Preferences>)dashboard.getChildren().get(0);
assertEquals("foo/bar", storage_.getId(app.getState()));
}
public void _testDashboardLayout() throws Exception
{
- PortletApplication dashboardPortlet = new PortletApplication();
+ Application<Preferences> dashboardPortlet = Application.createPortletApplication();
ApplicationState<Preferences> state = new TransientApplicationState<Preferences>("dashboard/DashboardPortlet");
dashboardPortlet.setState(state);
@@ -503,7 +502,7 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- PortletApplication app = new PortletApplication();
+ Application<Preferences> app = Application.createPortletApplication();
app.setState(new TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
page.getChildren().add(app);
storage_.save(page);
@@ -515,7 +514,7 @@
// Put a gadget in one container
Container row0 = (Container)dashboard.getChildren().get(0);
- GadgetApplication gadgetApp = new GadgetApplication();
+ Application<Gadget> gadgetApp = Application.createGadgetApplication();
gadgetApp.setState(new TransientApplicationState<Gadget>("foo"));
row0.getChildren().add(gadgetApp);
@@ -539,7 +538,7 @@
row1 = (Container)dashboard.getChildren().get(1);
assertEquals(0, row0.getChildren().size());
assertEquals(1, row1.getChildren().size());
- gadgetApp = (GadgetApplication)row1.getChildren().get(0);
+ gadgetApp = (Application<Gadget>)row1.getChildren().get(0);
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
@@ -547,7 +546,7 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- PortletApplication app = new PortletApplication();
+ Application<Preferences> app = Application.createPortletApplication();
app.setState(new TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
page.getChildren().add(app);
storage_.save(page);
@@ -559,7 +558,7 @@
// Put a gadget in one container
Container row1 = (Container)dashboard.getChildren().get(1);
- GadgetApplication gadgetApp = new GadgetApplication();
+ Application<Gadget> gadgetApp = Application.createGadgetApplication();
gadgetApp.setState(new TransientApplicationState<Gadget>("foo"));
row1.getChildren().add(gadgetApp);
@@ -583,11 +582,11 @@
row1 = (Container)dashboard.getChildren().get(1);
assertEquals(0, row1.getChildren().size());
assertEquals(1, row0.getChildren().size());
- gadgetApp = (GadgetApplication)row0.getChildren().get(0);
+ gadgetApp = (Application<Gadget>)row0.getChildren().get(0);
assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
- private PortletApplication create(String instanceId)
+ private Application<Preferences> create(String instanceId)
{
int i0 = instanceId.indexOf("#");
int i1 = instanceId.indexOf(":/", i0 + 1);
@@ -601,7 +600,7 @@
ownerType,
ownerId,
persistenceChunks[2]);
- PortletApplication portletApp = new PortletApplication();
+ Application<Preferences> portletApp = Application.createPortletApplication();
portletApp.setState(state);
return portletApp;
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-11-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -20,9 +20,9 @@
package org.exoplatform.portal.config;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetApplication;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -66,7 +66,7 @@
Gadget gadget = new Gadget();
gadget.setUserPref("user_pref");
TransientApplicationState<Gadget> state = new TransientApplicationState<Gadget>("bar", gadget);
- GadgetApplication gadgetApplication = new GadgetApplication();
+ Application<Gadget> gadgetApplication = Application.createGadgetApplication();
gadgetApplication.setState(state);
Page container = new Page();
@@ -76,7 +76,7 @@
storage_.create(container);
container = storage_.getPage("portal::test::gadget_page");
- gadgetApplication = (GadgetApplication)container.getChildren().get(0);
+ gadgetApplication = (Application<Gadget>)container.getChildren().get(0);
gadget = storage_.load(gadgetApplication.getState());
assertNotNull(gadget);
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -20,12 +20,12 @@
package org.exoplatform.portal.config;
import org.exoplatform.portal.application.PortletPreferences.PortletPreferencesSet;
+import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
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.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
import org.exoplatform.test.BasicTestCase;
@@ -110,8 +110,8 @@
{
IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
- PortletApplication app =
- (PortletApplication)uctx.unmarshalDocument(new FileInputStream(
+ Application<Preferences> app =
+ (Application<Preferences>)uctx.unmarshalDocument(new FileInputStream(
"src/test/resources/jibx/portlet-application.xml"), null);
TransientApplicationState portletState = (TransientApplicationState)app.getState();
assertNotNull(portletState);
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestPortletPreferences.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -20,9 +20,9 @@
package org.exoplatform.portal.config;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PersistentApplicationState;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.portlet.PreferencesBuilder;
@@ -65,7 +65,7 @@
public void testSiteScopedPreferences() throws Exception
{
Page page = storage_.getPage("portal::test::test4");
- PortletApplication app = (PortletApplication)page.getChildren().get(0);
+ Application<Preferences> app = (Application<Preferences>)page.getChildren().get(0);
PersistentApplicationState<Preferences> state = (PersistentApplicationState)app.getState();
//
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-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -23,13 +23,14 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
+import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -607,7 +608,7 @@
assertEquals("test5", clone.getName());
//
- PortletApplication app = (PortletApplication)clone.getChildren().get(0);
+ Application<Preferences> app = (Application<Preferences>)clone.getChildren().get(0);
Preferences prefs2 = storage_.load(app.getState());
assertEquals(new PreferencesBuilder().add("template",
"par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl").build(), prefs2);
@@ -640,7 +641,7 @@
assertEquals(1, clone.getChildren().size());
//
- PortletApplication app = (PortletApplication)clone.getChildren().get(0);
+ Application<Preferences> app = (Application<Preferences>)clone.getChildren().get(0);
assertEquals("Dashboard", app.getTitle());
assertNotNull(app.getState());
assertEquals("dashboard/DashboardPortlet", storage_.getId(app.getState()));
@@ -664,8 +665,8 @@
assertNotNull(container);
assertEquals(2, container.getChildren().size());
assertTrue(container.getChildren().get(0) instanceof PageBody);
- assertTrue(container.getChildren().get(1) instanceof PortletApplication);
- PortletApplication pa = (PortletApplication)container.getChildren().get(1);
+ assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
+ Application<Preferences> pa = (Application<Preferences>)container.getChildren().get(1);
ApplicationState state = pa.getState();
assertEquals("overwrite_application_ref/overwrite_portlet_ref", storage_.getId(pa.getState()));
}
@@ -697,8 +698,8 @@
assertNotNull(container);
assertEquals(2, container.getChildren().size());
assertTrue(container.getChildren().get(0) instanceof PageBody);
- assertTrue(container.getChildren().get(1) instanceof PortletApplication);
- PortletApplication pa = (PortletApplication)container.getChildren().get(1);
+ assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
+ Application<Preferences> pa = (Application<Preferences>)container.getChildren().get(1);
ApplicationState state = pa.getState();
assertEquals("foo/bar", storage_.getId(pa.getState()));
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-10 23:45:49 UTC (rev 554)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -20,9 +20,9 @@
package org.exoplatform.portal.config;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
@@ -68,7 +68,7 @@
String id = "portlet id";
wsrp.setPortletId(id);
TransientApplicationState<WSRP> state = new TransientApplicationState<WSRP>("test", wsrp);
- WSRPApplication wsrpApplication = new WSRPApplication();
+ Application<WSRP> wsrpApplication = Application.createWSRPApplication();
wsrpApplication.setState(state);
Page container = new Page();
@@ -79,7 +79,7 @@
storage_.create(container);
container = storage_.getPage(pageId);
- wsrpApplication = (WSRPApplication)container.getChildren().get(0);
+ wsrpApplication = (Application<WSRP>)container.getChildren().get(0);
wsrp = storage_.load(wsrpApplication.getState());
assertNotNull(wsrp);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-10 23:45:49 UTC (rev 554)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-11 00:30:04 UTC (rev 555)
@@ -29,9 +29,7 @@
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.SiteBody;
-import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.webui.application.PortletState;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
@@ -93,9 +91,9 @@
return model;
}
- private static GadgetApplication toGadget(UIGadget uiGadget)
+ private static Application<Gadget> toGadget(UIGadget uiGadget)
{
- GadgetApplication app = new GadgetApplication(uiGadget.getStorageId());
+ Application<Gadget> app = Application.createGadgetApplication(uiGadget.getStorageId());
app.setState(uiGadget.getState());
app.setProperties(uiGadget.getProperties());
app.setStorageName(uiGadget.getStorageName());
@@ -135,15 +133,15 @@
ApplicationType<S> type = state.getApplicationType();
if (type == ApplicationType.PORTLET)
{
- model = (Application<S>)new PortletApplication(uiPortlet.getStorageId());
+ model = (Application<S>)Application.createPortletApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.GADGET)
{
- model = (Application<S>)new GadgetApplication(uiPortlet.getStorageId());
+ model = (Application<S>)Application.createGadgetApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- model = (Application<S>)new WSRPApplication(uiPortlet.getStorageId());
+ model = (Application<S>)Application.createWSRPApplication(uiPortlet.getStorageId());
}
else
{
@@ -224,7 +222,7 @@
return model;
}
- static public void toUIGadget(UIGadget uiGadget, GadgetApplication model) throws Exception
+ static public void toUIGadget(UIGadget uiGadget, Application<Gadget> model) throws Exception
{
uiGadget.setProperties(model.getProperties());
uiGadget.setState(model.getState());
@@ -395,9 +393,9 @@
{
Application application = (Application)model;
- if (dashboard && application instanceof GadgetApplication)
+ if (dashboard && application.getType() == ApplicationType.GADGET)
{
- GadgetApplication ga = (GadgetApplication)application;
+ Application<Gadget> ga = (Application<Gadget>)application;
UIGadget uiGadget = uiContainer.createUIComponent(context, UIGadget.class, null, null);
uiGadget.setStorageId(application.getStorageId());
toUIGadget(uiGadget, ga);
15 years, 2 months
gatein SVN: r554 - in portal/trunk: component/application-registry/src/main/java/org/exoplatform/application/registry/mop and 12 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-10 18:45:49 -0500 (Tue, 10 Nov 2009)
New Revision: 554
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetId.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPId.java
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
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/DataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.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/model/gadget/GadgetApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.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/data/ModelDataStorage.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/TestUserPortalConfigService.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.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/PortletState.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.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/UIPortletActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
Log:
remove various application id (portlet,gadget,wsrp) to simplify as they were mere wrappers
Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/ApplicationRegistryService.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -33,7 +33,7 @@
public interface ApplicationRegistryService
{
- public List<ApplicationCategory> getApplicationCategories(String accessUser, ApplicationType<?, ?>... appTypes) throws Exception;
+ public List<ApplicationCategory> getApplicationCategories(String accessUser, ApplicationType<?>... appTypes) throws Exception;
public void initListener(ComponentPlugin com) throws Exception;
@@ -48,10 +48,10 @@
public void remove(ApplicationCategory category) throws Exception;
- public List<Application> getApplications(ApplicationCategory category, ApplicationType<?, ?>... appTypes) throws Exception;
+ public List<Application> getApplications(ApplicationCategory category, ApplicationType<?>... appTypes) throws Exception;
public List<Application> getApplications(ApplicationCategory category, Comparator<Application> sortComparator,
- ApplicationType<?, ?>... appTypes) throws Exception;
+ ApplicationType<?>... appTypes) throws Exception;
public List<Application> getAllApplications() throws Exception;
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/mop/MOPApplicationRegistryService.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -86,7 +86,7 @@
public List<ApplicationCategory> getApplicationCategories(
Comparator<ApplicationCategory> sortComparator,
String accessUser,
- ApplicationType<?, ?>... appTypes) throws Exception
+ ApplicationType<?>... appTypes) throws Exception
{
POMSession session = POMSessionManager.getSession();
ContentRegistry registry = session.getContentRegistry();
@@ -109,7 +109,7 @@
return categories;
}
- public List<ApplicationCategory> getApplicationCategories(String accessUser, ApplicationType<?, ?>... appTypes) throws Exception
+ public List<ApplicationCategory> getApplicationCategories(String accessUser, ApplicationType<?>... appTypes) throws Exception
{
return getApplicationCategories(null, accessUser, appTypes);
}
@@ -173,7 +173,7 @@
registry.getCategoryMap().remove(category.getName());
}
- public List<Application> getApplications(ApplicationCategory category, ApplicationType<?, ?>... appTypes) throws Exception
+ public List<Application> getApplications(ApplicationCategory category, ApplicationType<?>... appTypes) throws Exception
{
return getApplications(category, null, appTypes);
}
@@ -181,7 +181,7 @@
public List<Application> getApplications(
ApplicationCategory category,
Comparator<Application> sortComparator,
- ApplicationType<?, ?>... appTypes) throws Exception
+ ApplicationType<?>... appTypes) throws Exception
{
POMSession session = POMSessionManager.getSession();
ContentRegistry registry = session.getContentRegistry();
@@ -462,13 +462,13 @@
}
}
- private boolean isApplicationType(Application app, ApplicationType<?, ?>... appTypes)
+ private boolean isApplicationType(Application app, ApplicationType<?>... appTypes)
{
if (appTypes == null || appTypes.length == 0)
{
return true;
}
- for (ApplicationType<?, ?> appType : appTypes)
+ for (ApplicationType<?> appType : appTypes)
{
if (appType.equals(app.getType()))
{
@@ -487,7 +487,7 @@
categoryDef.setLastModificationDate(category.getModifiedDate());
}
- private ApplicationCategory load(CategoryDefinition categoryDef, ApplicationType<?, ?>... appTypes)
+ private ApplicationCategory load(CategoryDefinition categoryDef, ApplicationType<?>... appTypes)
{
ApplicationCategory category = new ApplicationCategory();
@@ -525,7 +525,7 @@
private Application load(ContentDefinition contentDef)
{
ContentType<?> contentType = contentDef.getCustomization().getType();
- ApplicationType<?, ?> applicationType = ApplicationType.getType(contentType);
+ ApplicationType<?> applicationType = ApplicationType.getType(contentType);
//
Application application = new Application();
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -98,7 +98,7 @@
public void save(PortletPreferences portletPreferences) throws Exception;
- public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception;
+ public <S> String getId(ApplicationState<S> state) throws Exception;
public <S> S load(ApplicationState<S> state) throws Exception;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -22,7 +22,6 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -244,9 +243,9 @@
return find(q, null);
}
- public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception
+ public <S> String getId(ApplicationState<S> state) throws Exception
{
- return delegate.getId(type, state);
+ return delegate.getId(state);
}
public void save(PortletPreferences portletPreferences) throws Exception
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -29,7 +29,7 @@
* @email: tuan08(a)users.sourceforge.net
* @version: $Id: Portlet.java,v 1.7 2004/09/30 01:00:05 tuan08 Exp $
**/
-public abstract class Application<S, I> extends ModelObject
+public abstract class Application<S> extends ModelObject
{
/** The application state. */
@@ -61,7 +61,7 @@
private boolean isModifiable;
- public Application(ApplicationData<S, I> data)
+ public Application(ApplicationData<S> data)
{
super(data.getStorageId());
@@ -95,7 +95,7 @@
super();
}
- public abstract ApplicationType<S, I> getType();
+ public abstract ApplicationType<S> getType();
public String getWidth()
{
@@ -242,7 +242,7 @@
@Override
public ModelData build()
{
- return new ApplicationData<S,I>(
+ return new ApplicationData<S>(
storageId,
storageName,
getType(),
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -19,9 +19,6 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
@@ -33,12 +30,11 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
* @param <S> the content state type of the application
- * @param <I> the id type of the application
*/
-public class ApplicationType<S, I>
+public class ApplicationType<S>
{
- public static ApplicationType<?, ?> getType(String name)
+ public static ApplicationType<?> getType(String name)
{
if (PORTLET.getName().equals(name))
{
@@ -58,19 +54,19 @@
}
}
- public static <S> ApplicationType<S, ?> getType(ContentType<S> name)
+ public static <S> ApplicationType<S> getType(ContentType<S> name)
{
if (PORTLET.getContentType().equals(name))
{
- return (ApplicationType<S,?>)ApplicationType.PORTLET;
+ return (ApplicationType<S>)ApplicationType.PORTLET;
}
else if (GADGET.getContentType().equals(name))
{
- return (ApplicationType<S,?>)ApplicationType.GADGET;
+ return (ApplicationType<S>)ApplicationType.GADGET;
}
else if (WSRP_PORTLET.getContentType().equals(name))
{
- return (ApplicationType<S,?>)ApplicationType.WSRP_PORTLET;
+ return (ApplicationType<S>)ApplicationType.WSRP_PORTLET;
}
else
{
@@ -79,13 +75,13 @@
}
/** . */
- public static final ApplicationType<Preferences, PortletId> PORTLET = new ApplicationType<Preferences, PortletId>(Preferences.CONTENT_TYPE, "portlet");
+ public static final ApplicationType<Preferences> PORTLET = new ApplicationType<Preferences>(Preferences.CONTENT_TYPE, "portlet");
/** . */
- public static final ApplicationType<Gadget, GadgetId> GADGET = new ApplicationType<Gadget, GadgetId>(Gadget.CONTENT_TYPE, "gadget");
+ public static final ApplicationType<Gadget> GADGET = new ApplicationType<Gadget>(Gadget.CONTENT_TYPE, "gadget");
/** . */
- public static final ApplicationType<WSRP, WSRPId> WSRP_PORTLET = new ApplicationType<WSRP, WSRPId>(WSRP.CONTENT_TYPE, "wsrp");
+ public static final ApplicationType<WSRP> WSRP_PORTLET = new ApplicationType<WSRP>(WSRP.CONTENT_TYPE, "wsrp");
/** . */
private final ContentType<S> contentType;
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ModelObject.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -20,11 +20,8 @@
package org.exoplatform.portal.config.model;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.data.ApplicationData;
import org.exoplatform.portal.pom.data.BodyData;
import org.exoplatform.portal.pom.data.ContainerData;
@@ -108,15 +105,15 @@
ApplicationType type = applicationData.getType();
if (ApplicationType.PORTLET == type)
{
- return new PortletApplication((ApplicationData<Preferences, PortletId>)applicationData);
+ return new PortletApplication((ApplicationData<Preferences>)applicationData);
}
else if (ApplicationType.GADGET == type)
{
- return new GadgetApplication((ApplicationData<Gadget, GadgetId>)applicationData);
+ return new GadgetApplication((ApplicationData<Gadget>)applicationData);
}
else if (ApplicationType.WSRP_PORTLET == type)
{
- return new WSRPApplication((ApplicationData<WSRP, WSRPId>)applicationData);
+ return new WSRPApplication((ApplicationData<WSRP>)applicationData);
}
else
{
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -28,10 +28,10 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class GadgetApplication extends Application<Gadget, GadgetId>
+public class GadgetApplication extends Application<Gadget>
{
- public GadgetApplication(ApplicationData<Gadget, GadgetId> data)
+ public GadgetApplication(ApplicationData<Gadget> data)
{
super(data);
}
@@ -45,7 +45,7 @@
{
}
- public ApplicationType<Gadget, GadgetId> getType()
+ public ApplicationType<Gadget> getType()
{
return ApplicationType.GADGET;
}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetId.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetId.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetId.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -1,43 +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.config.model.gadget;
-
-/**
- * The id of a gadget that is an immutable class.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class GadgetId
-{
-
- /** . */
- private final String gadgetName;
-
- public GadgetId(String gadgetName)
- {
- this.gadgetName = gadgetName;
- }
-
- public String getGadgetName()
- {
- return gadgetName;
- }
-}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -28,10 +28,10 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class PortletApplication extends Application<Preferences, PortletId>
+public class PortletApplication extends Application<Preferences>
{
- public PortletApplication(ApplicationData<Preferences, PortletId> data)
+ public PortletApplication(ApplicationData<Preferences> data)
{
super(data);
}
@@ -46,7 +46,7 @@
super();
}
- public ApplicationType<Preferences, PortletId> getType()
+ public ApplicationType<Preferences> getType()
{
return ApplicationType.PORTLET;
}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -1,85 +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.config.model.portlet;
-
-import org.exoplatform.commons.utils.Safe;
-
-/**
- * The immutable id of a portlet application.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletId
-{
-
- /** . */
- private final String applicationName;
-
- /** . */
- private final String portletName;
-
- public PortletId(String applicationName, String portletName)
- {
- if (applicationName == null)
- {
- throw new NullPointerException();
- }
- if (portletName == null)
- {
- throw new NullPointerException();
- }
-
- //
- this.applicationName = applicationName;
- this.portletName = portletName;
- }
-
- public String getApplicationName()
- {
- return applicationName;
- }
-
- public String getPortletName()
- {
- return portletName;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof PortletId)
- {
- PortletId that = (PortletId)obj;
- return Safe.equals(applicationName, that.applicationName) && Safe.equals(portletName, that.portletName);
- }
- return false;
- }
-
- @Override
- public String toString()
- {
- return "PortletId[applicationName=" + applicationName + ",portletName=" + portletName + "]";
- }
-}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -28,9 +28,9 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-public class WSRPApplication extends Application<WSRP, WSRPId>
+public class WSRPApplication extends Application<WSRP>
{
- public WSRPApplication(ApplicationData<WSRP, WSRPId> wsrpwsrpIdApplicationData)
+ public WSRPApplication(ApplicationData<WSRP> wsrpwsrpIdApplicationData)
{
super(wsrpwsrpIdApplicationData);
}
@@ -46,7 +46,7 @@
}
@Override
- public ApplicationType<WSRP, WSRPId> getType()
+ public ApplicationType<WSRP> getType()
{
return ApplicationType.WSRP_PORTLET;
}
Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPId.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPId.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPId.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -1,45 +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.config.model.wsrp;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class WSRPId
-{
- /** . */
- private String uri;
-
- public WSRPId(String uri)
- {
- this.uri = uri;
- }
-
- public String getUri()
- {
- return uri;
- }
-
- public void setUri(String uri)
- {
- this.uri = uri;
- }
-}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -26,14 +26,10 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.config.cache.DataCache;
import org.exoplatform.portal.pom.config.tasks.DashboardTask;
import org.exoplatform.portal.pom.data.DashboardData;
@@ -197,7 +193,7 @@
execute(new PortletPreferencesTask.Save(portletPreferences));
}
- public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception
+ public <S> String getId(ApplicationState<S> state) throws Exception
{
String contentId;
if (state instanceof TransientApplicationState)
@@ -221,23 +217,7 @@
}
//
- if (type == ApplicationType.PORTLET)
- {
- String[] chunks = contentId.split("/");
- return (I)new PortletId(chunks[0], chunks[1]);
- }
- else if (type == ApplicationType.GADGET)
- {
- return (I)new GadgetId(contentId);
- }
- else if (type == ApplicationType.WSRP_PORTLET)
- {
- return (I)new WSRPId(contentId);
- }
- else
- {
- throw new UnsupportedOperationException();
- }
+ return contentId;
}
public <S> S load(ApplicationState<S> state) throws Exception
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -28,11 +28,11 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class ApplicationData<S, I> extends ComponentData
+public class ApplicationData<S> extends ComponentData
{
/** . */
- private final ApplicationType<S, I> type;
+ private final ApplicationType<S> type;
/** . */
private final ApplicationState<S> state;
@@ -76,7 +76,7 @@
public ApplicationData(
String storageId,
String storageName,
- ApplicationType<S, I> type,
+ ApplicationType<S> type,
ApplicationState<S> state,
String id,
String title,
@@ -109,7 +109,7 @@
this.accessPermissions = accessPermissions;
}
- public ApplicationType<S, I> getType()
+ public ApplicationType<S> getType()
{
return type;
}
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -27,12 +27,9 @@
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.Utils;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
-import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
@@ -440,7 +437,7 @@
owner.getName(),
null
);
- mo = new ApplicationData<Preferences, PortletId>(
+ mo = new ApplicationData<Preferences>(
srcContainer.getObjectId(),
component.getName(),
ApplicationType.PORTLET,
@@ -515,7 +512,7 @@
}
else if (src instanceof ApplicationData)
{
- save((ApplicationData<?, ?>)src, (UIWindow)dst);
+ save((ApplicationData<?>)src, (UIWindow)dst);
}
else if (src instanceof BodyData)
{
@@ -527,9 +524,6 @@
}
}
- /** . */
- private static final PortletId DASHBOARD_ID = new PortletId("dashboard", "DashboardPortlet");
-
private LinkedList<ModelChange> saveChildren(final ContainerData src, UIContainer dst)
{
@@ -736,7 +730,7 @@
}
}
- private <S, I> ApplicationData<S, I> load(UIWindow src)
+ private <S> ApplicationData<S> load(UIWindow src)
{
Attributes attrs = src.getAttributes();
@@ -749,8 +743,8 @@
//
String customizationid = customization.getId();
- //
- ApplicationType<S, I> type = (ApplicationType<S,I>)ApplicationType.getType(contentType);
+ // julien: should type check that
+ ApplicationType<S> type = (ApplicationType<S>)ApplicationType.getType(contentType);
//
PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
@@ -760,7 +754,7 @@
load(attrs, properties, windowPropertiesBlackList);
//
- return new ApplicationData<S,I>(
+ return new ApplicationData<S>(
src.getObjectId(),
src.getName(),
type,
@@ -780,7 +774,7 @@
);
}
- public <S, I> void save(ApplicationData<S, I> src, UIWindow dst)
+ public <S, I> void save(ApplicationData<S> src, UIWindow dst)
{
Attributes attrs = dst.getAttributes();
attrs.setValue(MappedAttributes.THEME, src.getTheme());
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -92,7 +92,7 @@
public void save(PortletPreferences portletPreferences) throws Exception;
- public <S, I> I getId(ApplicationType<S, I> type, ApplicationState<S> state) throws Exception;
+ public <S> String getId(ApplicationState<S> state) throws Exception;
public <S> S load(ApplicationState<S> state) throws Exception;
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -26,7 +26,6 @@
import org.exoplatform.portal.application.Preference;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
@@ -35,9 +34,7 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -304,7 +301,7 @@
storage_.save(page);
page = storage_.getPage(page.getPageId());
app = (PortletApplication)page.getChildren().get(0);
- assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, app.getState()));
+ assertEquals("web/BannerPortlet", storage_.getId(app.getState()));
}
public void testPageMerge() throws Exception
@@ -383,7 +380,7 @@
ApplicationState<Preferences> instanceId = banner1.getState();
// Check instance id format
- assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, banner1.getState()));
+ assertEquals("web/BannerPortlet", storage_.getId(banner1.getState()));
// Check state
Preferences pagePrefs = storage_.load(instanceId);
@@ -400,7 +397,7 @@
instanceId = banner1.getState();
// Check instance id format
- assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, banner1.getState()));
+ assertEquals("web/BannerPortlet", storage_.getId(banner1.getState()));
// Update site prefs
PortletPreferences sitePrefs = new PortletPreferences();
@@ -450,7 +447,7 @@
String dashboardId = dashboardPortlet.getStorageId();
assertNotNull(dashboardId);
assertNotNull(dashboardPortlet.getStorageName());
- assertEquals(new PortletId("dashboard", "DashboardPortlet"), storage_.getId(ApplicationType.PORTLET, dashboardPortlet.getState()));
+ assertEquals("dashboard/DashboardPortlet", storage_.getId(dashboardPortlet.getState()));
// Configures the dashboard
Dashboard dashboard = new Dashboard(dashboardId);
@@ -471,7 +468,7 @@
dashboard = storage_.loadDashboard(dashboardId);
assertEquals(1, dashboard.getChildren().size());
app = (PortletApplication)dashboard.getChildren().get(0);
- assertEquals(new PortletId("foo", "bar"), storage_.getId(ApplicationType.PORTLET, app.getState()));
+ assertEquals("foo/bar", storage_.getId(app.getState()));
}
public void _testDashboardLayout() throws Exception
@@ -543,7 +540,7 @@
assertEquals(0, row0.getChildren().size());
assertEquals(1, row1.getChildren().size());
gadgetApp = (GadgetApplication)row1.getChildren().get(0);
- assertEquals(new GadgetId("foo"), storage_.getId(ApplicationType.GADGET, gadgetApp.getState()));
+ assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
public void _testDashboardMoveLeft() throws Exception
@@ -587,7 +584,7 @@
assertEquals(0, row1.getChildren().size());
assertEquals(1, row0.getChildren().size());
gadgetApp = (GadgetApplication)row0.getChildren().get(0);
- assertEquals(new GadgetId("foo"), storage_.getId(ApplicationType.GADGET, gadgetApp.getState()));
+ assertEquals("foo", storage_.getId(gadgetApp.getState()));
}
private PortletApplication create(String instanceId)
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -24,14 +24,12 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -645,7 +643,7 @@
PortletApplication app = (PortletApplication)clone.getChildren().get(0);
assertEquals("Dashboard", app.getTitle());
assertNotNull(app.getState());
- assertEquals(new PortletId("dashboard", "DashboardPortlet"), storage_.getId(ApplicationType.PORTLET, 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());
@@ -669,7 +667,7 @@
assertTrue(container.getChildren().get(1) instanceof PortletApplication);
PortletApplication pa = (PortletApplication)container.getChildren().get(1);
ApplicationState state = pa.getState();
- assertEquals(new PortletId("overwrite_application_ref", "overwrite_portlet_ref"), storage_.getId(ApplicationType.PORTLET, pa.getState()));
+ assertEquals("overwrite_application_ref/overwrite_portlet_ref", storage_.getId(pa.getState()));
}
}.execute(null);
}
@@ -702,7 +700,7 @@
assertTrue(container.getChildren().get(1) instanceof PortletApplication);
PortletApplication pa = (PortletApplication)container.getChildren().get(1);
ApplicationState state = pa.getState();
- assertEquals(new PortletId("foo", "bar"), storage_.getId(ApplicationType.PORTLET, pa.getState()));
+ assertEquals("foo/bar", storage_.getId(pa.getState()));
}
}.execute(null);
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -23,7 +23,6 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -46,9 +46,9 @@
public class GetApplicationHandler extends Command
{
- private ApplicationType<?, ?>[] applicationType;
+ private ApplicationType<?>[] applicationType;
- public void setApplicationTypes(ApplicationType<?, ?>[] type)
+ public void setApplicationTypes(ApplicationType<?>[] type)
{
applicationType = type;
}
@@ -77,7 +77,7 @@
(ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
if (applicationType == null)
- applicationType = new ApplicationType<?, ?>[0];
+ applicationType = new ApplicationType<?>[0];
List<ApplicationCategory> appCategories = prService.getApplicationCategories(remoteUser, applicationType);
ApplicationCategoryToJSONPlugin toJSON = new ApplicationCategoryToJSONPlugin();
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -26,11 +26,9 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pc.ExoPortletState;
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.Preference;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -51,24 +49,24 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public abstract class ModelAdapter<S, C extends Serializable, I>
+public abstract class ModelAdapter<S, C extends Serializable>
{
- public static <S, C extends Serializable, I> ModelAdapter<S, C, I> getAdapter(ApplicationType<S, I> type)
+ public static <S, C extends Serializable, I> ModelAdapter<S, C> getAdapter(ApplicationType<S> type)
{
if (type == ApplicationType.PORTLET)
{
- @SuppressWarnings("unchecked") ModelAdapter<S, C, I> adapter = (ModelAdapter<S, C, I>)PORTLET;
+ @SuppressWarnings("unchecked") ModelAdapter<S, C> adapter = (ModelAdapter<S, C>)PORTLET;
return adapter;
}
else if (type == ApplicationType.GADGET)
{
- @SuppressWarnings("unchecked") ModelAdapter<S, C, I> adapter = (ModelAdapter<S, C, I>)GADGET;
+ @SuppressWarnings("unchecked") ModelAdapter<S, C> adapter = (ModelAdapter<S, C>)GADGET;
return adapter;
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- @SuppressWarnings("unchecked") ModelAdapter<S, C, I> adapter = (ModelAdapter<S, C, I>)WSRP;
+ @SuppressWarnings("unchecked") ModelAdapter<S, C> adapter = (ModelAdapter<S, C>)WSRP;
return adapter;
}
else
@@ -78,11 +76,11 @@
}
/** . */
- private static final ModelAdapter<Preferences, ExoPortletState, PortletId> PORTLET = new ModelAdapter<Preferences, ExoPortletState, PortletId>()
+ private static final ModelAdapter<Preferences, ExoPortletState> PORTLET = new ModelAdapter<Preferences, ExoPortletState>()
{
@Override
- public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, PortletId applicationId, ApplicationState<Preferences> applicationState) throws Exception
+ public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, String applicationId, ApplicationState<Preferences> applicationState) throws Exception
{
DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
Preferences preferences = dataStorage.load(applicationState);
@@ -123,10 +121,11 @@
}
@Override
- public PortletContext getProducerOfferedPortletContext(PortletId applicationState)
+ public PortletContext getProducerOfferedPortletContext(String applicationState)
{
- String appName = applicationState.getApplicationName();
- String portletName = applicationState.getPortletName();
+ String[] chunks = Utils.split("/", applicationState);
+ String appName = chunks[0];
+ String portletName = chunks[1];
return PortletContext.createPortletContext(PortletInvoker.LOCAL_PORTLET_INVOKER_ID + "./" + appName + "." + portletName);
}
@@ -149,7 +148,7 @@
}
};
- private static final ModelAdapter<Gadget, ExoPortletState, GadgetId> GADGET = new ModelAdapter<Gadget, ExoPortletState, GadgetId>()
+ private static final ModelAdapter<Gadget, ExoPortletState> GADGET = new ModelAdapter<Gadget, ExoPortletState>()
{
/** . */
@@ -159,10 +158,10 @@
private final PortletContext WRAPPER_CONTEXT = PortletContext.createPortletContext(WRAPPER_ID);
@Override
- public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, GadgetId applicationId, ApplicationState<Gadget> applicationState) throws Exception
+ public StatefulPortletContext<ExoPortletState> getPortletContext(ExoContainer container, String applicationId, ApplicationState<Gadget> applicationState) throws Exception
{
GadgetRegistryService gadgetService = (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
- org.exoplatform.application.gadget.Gadget model = gadgetService.getGadget(applicationId.getGadgetName());
+ org.exoplatform.application.gadget.Gadget model = gadgetService.getGadget(applicationId);
GadgetApplication application = new GadgetApplication(model.getName(), model.getUrl(), model.isLocal());
String url = GadgetUtil.reproduceUrl(application.getUrl(), application.isLocal());
ExoPortletState prefs = new ExoPortletState(WRAPPER_ID);
@@ -177,7 +176,7 @@
}
@Override
- public PortletContext getProducerOfferedPortletContext(GadgetId applicationState)
+ public PortletContext getProducerOfferedPortletContext(String applicationState)
{
return WRAPPER_CONTEXT;
}
@@ -191,7 +190,7 @@
};
- private static final ModelAdapter<WSRP, WSRP, WSRPId> WSRP = new ModelAdapter<WSRP, WSRP, WSRPId>()
+ private static final ModelAdapter<WSRP, WSRP> WSRP = new ModelAdapter<WSRP, WSRP>()
{
@Override
public Preferences getState(ExoContainer container, ApplicationState<WSRP> state) throws Exception
@@ -200,20 +199,20 @@
}
@Override
- public PortletContext getProducerOfferedPortletContext(WSRPId applicationId)
+ public PortletContext getProducerOfferedPortletContext(String applicationId)
{
- return PortletContext.createPortletContext(applicationId.getUri());
+ return PortletContext.createPortletContext(applicationId);
}
@Override
- public StatefulPortletContext<WSRP> getPortletContext(ExoContainer container, WSRPId applicationId, ApplicationState<WSRP> state) throws Exception
+ public StatefulPortletContext<WSRP> getPortletContext(ExoContainer container, String applicationId, ApplicationState<WSRP> state) throws Exception
{
DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
WSRP wsrp = dataStorage.load(state);
if (wsrp == null)
{
wsrp = new WSRP();
- wsrp.setPortletId(applicationId.getUri());
+ wsrp.setPortletId(applicationId);
}
return StatefulPortletContext.create(wsrp.getPortletId(), WSRPPortletStateType.instance, wsrp);
}
@@ -236,9 +235,9 @@
}
};
- public abstract PortletContext getProducerOfferedPortletContext(I applicationId);
+ public abstract PortletContext getProducerOfferedPortletContext(String applicationId);
- public abstract StatefulPortletContext<C> getPortletContext(ExoContainer container, I applicationId, ApplicationState<S> applicationState) throws Exception;
+ public abstract StatefulPortletContext<C> getPortletContext(ExoContainer container, String applicationId, ApplicationState<S> applicationState) throws Exception;
public abstract ApplicationState<S> update(ExoContainer container, C updateState, ApplicationState<S> applicationState) throws Exception;
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -28,24 +28,23 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
* @param <S> the application content state type
- * @param <I> the application id type
*/
-public class PortletState<S, I>
+public class PortletState<S>
{
/** The application type. */
- private final ApplicationType<S, I> applicationType;
+ private final ApplicationType<S> applicationType;
/** The application state. */
private ApplicationState<S> applicationState;
- public PortletState(ApplicationState<S> applicationState, ApplicationType<S, I> applicationType)
+ public PortletState(ApplicationState<S> applicationState, ApplicationType<S> applicationType)
{
this.applicationState = applicationState;
this.applicationType = applicationType;
}
- public ApplicationType<S, I> getApplicationType()
+ public ApplicationType<S> getApplicationType()
{
return applicationType;
}
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -24,9 +24,7 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationState;
-import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Properties;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.WebAppController;
import org.exoplatform.web.application.gadget.GadgetApplication;
@@ -66,7 +64,7 @@
private ApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget> state;
/** . */
- private GadgetId gadgetId;
+ private String gadgetId;
private Properties properties_;
@@ -136,7 +134,7 @@
try
{
DataStorage ds= getApplicationComponent(DataStorage.class);
- GadgetId gadgetId = ds.getId(ApplicationType.GADGET, state);
+ String gadgetId = ds.getId(state);
//
this.gadgetId = gadgetId;
@@ -162,7 +160,7 @@
*/
public String getApplicationName()
{
- return gadgetId.getGadgetName();
+ return gadgetId;
}
/**
@@ -222,14 +220,14 @@
private GadgetApplication getApplication()
{
WebAppController webController = getApplicationComponent(WebAppController.class);
- GadgetApplication application = webController.getApplication("eXoGadgets/" + gadgetId.getGadgetName());
+ GadgetApplication application = webController.getApplication("eXoGadgets/" + gadgetId);
if (application == null)
{
GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
Gadget model;
try
{
- model = gadgetService.getGadget(gadgetId.getGadgetName());
+ model = gadgetService.getGadget(gadgetId);
}
catch (Exception ex)
{
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-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -25,7 +25,6 @@
import org.exoplatform.portal.application.UserProfileLifecycle;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.pom.spi.wsrp.WSRP;
import org.exoplatform.portal.webui.application.UIPortletActionListener.ChangePortletModeActionListener;
@@ -110,7 +109,7 @@
@EventConfig(phase = Phase.PROCESS, listeners = ProcessEventsActionListener.class)
}
)
-public class UIPortlet<S, C extends Serializable, I> extends UIApplication
+public class UIPortlet<S, C extends Serializable> extends UIApplication
{
protected static final Log log = ExoLogger.getLogger("portal:UIPortlet");
@@ -124,7 +123,7 @@
private String storageName;
/** . */
- private ModelAdapter<S, C, I> adapter;
+ private ModelAdapter<S, C> adapter;
/** . */
private Portlet producedOfferedPortlet;
@@ -136,10 +135,10 @@
private LocalizedString displayName;
/** . */
- private PortletState<S, I> state;
+ private PortletState<S> state;
/** . */
- private I applicationId;
+ private String applicationId;
private String theme_;
private String portletStyle;
@@ -195,10 +194,10 @@
*/
public String getSkinId()
{
- ApplicationType<S, I> type = state.getApplicationType();
+ ApplicationType<S> type = state.getApplicationType();
if (type == ApplicationType.PORTLET)
{
- return ((PortletId)applicationId).getApplicationName() + "/" + ((PortletId)applicationId).getPortletName();
+ return applicationId;
}
else if (type == ApplicationType.GADGET)
{
@@ -215,7 +214,7 @@
return storageName;
}
- public I getApplicationId()
+ public String getApplicationId()
{
return applicationId;
}
@@ -741,12 +740,12 @@
update(updateState);
}
- public PortletState<S, I> getState()
+ public PortletState<S> getState()
{
return state;
}
- public void setState(PortletState<S, I> state)
+ public void setState(PortletState<S> state)
{
if (state != null)
{
@@ -754,8 +753,8 @@
{
PortletInvoker portletInvoker = getApplicationComponent(PortletInvoker.class);
DataStorage dataStorage = getApplicationComponent(DataStorage.class);
- I applicationId = dataStorage.getId(state.getApplicationType(), state.getApplicationState());
- ModelAdapter<S, C, I> adapter = ModelAdapter.getAdapter(state.getApplicationType());
+ String applicationId = dataStorage.getId(state.getApplicationState());
+ ModelAdapter<S, C> adapter = ModelAdapter.getAdapter(state.getApplicationType());
PortletContext producerOfferedPortletContext = adapter.getProducerOfferedPortletContext(applicationId);
Portlet producedOfferedPortlet = portletInvoker.getPortlet(producerOfferedPortletContext);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -80,11 +80,11 @@
* same portal page
*/
static public class ProcessActionActionListener<S, C extends Serializable, I> extends
- EventListener<UIPortlet<S, C, I>>
+ EventListener<UIPortlet<S, C>>
{
- public void execute(Event<UIPortlet<S, C, I>> event) throws Exception
+ public void execute(Event<UIPortlet<S, C>> event) throws Exception
{
- UIPortlet<S, C, I> uiPortlet = event.getSource();
+ UIPortlet<S, C> uiPortlet = event.getSource();
PortalRequestContext prcontext = (PortalRequestContext)event.getRequestContext();
//
@@ -294,11 +294,11 @@
* processRender() method of the portal is not called as we set the response as complete
*/
static public class ServeResourceActionListener<S, C extends Serializable, I> extends
- EventListener<UIPortlet<S, C, I>>
+ EventListener<UIPortlet<S, C>>
{
- public void execute(Event<UIPortlet<S, C, I>> event) throws Exception
+ public void execute(Event<UIPortlet<S, C>> event) throws Exception
{
- UIPortlet<S, C, I> uiPortlet = event.getSource();
+ UIPortlet<S, C> uiPortlet = event.getSource();
log.info("Serve Resource for portlet: " + uiPortlet.getPortletContext());
try
{
@@ -449,7 +449,7 @@
* The processEvent() method can also generates IPC events and hence the portal itself will call the
* ProcessEventsActionListener once again
*/
- public static <S, C extends Serializable, I> List<javax.portlet.Event> processEvent(UIPortlet<S, C, I> uiPortlet,
+ public static <S, C extends Serializable, I> List<javax.portlet.Event> processEvent(UIPortlet<S, C> uiPortlet,
javax.portlet.Event event)
{
log.info("Process Event: " + event.getName() + " for portlet: " + uiPortlet.getState());
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -51,7 +51,7 @@
/**
* Created by The eXo Platform SAS May 8, 2006
*/
-public class UIPortletLifecycle<S, C extends Serializable, I> extends Lifecycle<UIPortlet<S, C, I>>
+public class UIPortletLifecycle<S, C extends Serializable, I> extends Lifecycle<UIPortlet<S, C>>
{
protected static Log log = ExoLogger.getLogger("portal:UIPortletLifecycle");
@@ -71,7 +71,7 @@
* broadcasted and the portlet is added in the list of components to update
* within the AJAX call
*/
- public void processAction(UIPortlet<S, C, I> uicomponent, WebuiRequestContext context) throws Exception
+ public void processAction(UIPortlet<S, C> uicomponent, WebuiRequestContext context) throws Exception
{
String action = context.getRequestParameter(PortalRequestContext.UI_COMPONENT_ACTION);
if (action != null)
@@ -146,7 +146,7 @@
* one, just write in the buffer the content returned by the portlet container
* 4) If not AJAX, then merge the content with the UIPortlet.gtmpl
*/
- public void processRender(UIPortlet<S, C, I> uicomponent, WebuiRequestContext context) throws Exception
+ public void processRender(UIPortlet<S, C> uicomponent, WebuiRequestContext context) throws Exception
{
PortalRequestContext prcontext = (PortalRequestContext)context;
ExoContainer container = prcontext.getApplication().getApplicationServiceContainer();
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -128,22 +128,22 @@
model.setChildren(children);
}
- private static <S, I> Application<S, I> toPortletModel(UIPortlet<S, ?, I> uiPortlet)
+ private static <S> Application<S> toPortletModel(UIPortlet<S, ?> uiPortlet)
{
- Application<S, I> model;
- PortletState<S, I> state = uiPortlet.getState();
- ApplicationType<S, I> type = state.getApplicationType();
+ Application<S> model;
+ PortletState<S> state = uiPortlet.getState();
+ ApplicationType<S> type = state.getApplicationType();
if (type == ApplicationType.PORTLET)
{
- model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId());
+ model = (Application<S>)new PortletApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.GADGET)
{
- model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId());
+ model = (Application<S>)new GadgetApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId());
+ model = (Application<S>)new WSRPApplication(uiPortlet.getStorageId());
}
else
{
@@ -234,11 +234,11 @@
* Fill the UI component with both information from the persistent model and
* some coming from the portlet.xml defined by the JSR 286 specification
*/
- private static <S, I> void toUIPortlet(UIPortlet<S, ?, I> uiPortlet, Application<S, I> model) throws Exception
+ private static <S> void toUIPortlet(UIPortlet<S, ?> uiPortlet, Application<S> model) throws Exception
{
//
- PortletState<S, I> portletState = new PortletState<S, I>(model.getState(), model.getType());
+ PortletState<S> portletState = new PortletState<S>(model.getState(), model.getType());
/*
* Fill UI component object with info from the XML file that persist portlet
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2009-11-10 22:46:33 UTC (rev 553)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2009-11-10 23:45:49 UTC (rev 554)
@@ -19,8 +19,8 @@
package org.exoplatform.portal.webui.workspace;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
-import org.exoplatform.portal.config.model.portlet.PortletId;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -79,19 +79,19 @@
for (UIPortlet portlet : portletInstancesInPage)
{
- Object applicationId = portlet.getApplicationId();
- if (applicationId instanceof PortletId)
+ String applicationId = portlet.getApplicationId();
+ ApplicationType<?> type = portlet.getState().getApplicationType();
+ if (type == ApplicationType.PORTLET)
{
- PortletId portletId = (PortletId)applicationId;
- if (portletId.getPortletName().equals(portletName))
+ String[] chunks = Utils.split("/", applicationId);
+ if (chunks[1].equals(portletName))
{
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(portlet);
}
}
- else if (applicationId instanceof GadgetId)
+ else if (type == ApplicationType.GADGET)
{
- GadgetId gadgetId = (GadgetId)applicationId;
- if (gadgetId.getGadgetName().equals(portletName))
+ if (applicationId.equals(portletName))
{
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(portlet);
}
15 years, 2 months
gatein SVN: r553 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/config/model and 14 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-10 17:46:33 -0500 (Tue, 10 Nov 2009)
New Revision: 553
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIAddGadgetForm.java
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.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/TransientApplicationState.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.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/pom/config/POMDataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.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/Preferences.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/TestGadget.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/TestUserPortalConfigService.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.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/UIGadget.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/portal/UIPortalComponentActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
Log:
use the notion of application id in a more correct manner (we cannot always assume that the appliation id is the same than the one reflected by the application state)
Modified: portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIAddGadgetForm.java
===================================================================
--- portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIAddGadgetForm.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIAddGadgetForm.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -21,7 +21,7 @@
import org.exoplatform.application.gadget.Gadget;
import org.exoplatform.application.gadget.GadgetRegistryService;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.webui.application.GadgetUtil;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.services.rss.parser.DefaultRSSChannel;
@@ -92,7 +92,7 @@
gadget = GadgetUtil.toGadget(name, url, false);
service.saveGadget(gadget);
uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(gadget.getName()));
+ uiGadget.setState(new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>(gadget.getName()));
}
catch (Exception e)
{
@@ -115,7 +115,7 @@
//TODO make sure it's an rss feed
// TODO make sure that we did not add it already
uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(gadget.getName()));
+ uiGadget.setState(new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>(gadget.getName()));
String params = "{'rssurl':'" + url + "'}";
Modified: portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
--- portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -24,7 +24,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
@@ -485,7 +486,7 @@
return;
}
UIGadget uiGadget = event.getSource().createUIComponent(context, UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(application.getApplicationName()));
+ uiGadget.setState(new TransientApplicationState<Gadget>(application.getApplicationName()));
UIDashboardContainer uiDashboardContainer = uiDashboard.getChild(UIDashboardContainer.class);
uiDashboardContainer.addUIGadget(uiGadget, col, row);
uiDashboardContainer.save();
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -35,9 +35,6 @@
/** The application state. */
private ApplicationState<S> state;
- /** The reference to the application. */
- private I ref;
-
private String id;
private String title;
@@ -74,7 +71,6 @@
//
this.state = data.getState();
- this.ref = data.getRef();
this.id = data.getId();
this.title = data.getTitle();
this.icon = data.getIcon();
@@ -89,17 +85,14 @@
this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
}
- public Application(String storageId, I ref)
+ public Application(String storageId)
{
super(storageId);
-
- //
- this.ref = ref;
}
- public Application(I ref)
+ public Application()
{
- this.ref = ref;
+ super();
}
public abstract ApplicationType<S, I> getType();
@@ -164,11 +157,6 @@
state = value;
}
- public I getRef()
- {
- return ref;
- }
-
public boolean getShowInfoBar()
{
return showInfoBar;
@@ -259,7 +247,6 @@
storageName,
getType(),
state,
- ref,
id,
title,
icon,
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/ApplicationType.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -79,12 +79,10 @@
}
/** . */
- public static final ApplicationType<Preferences, PortletId> PORTLET =
- new ApplicationType<Preferences, PortletId>(Preferences.CONTENT_TYPE, "portlet");
+ public static final ApplicationType<Preferences, PortletId> PORTLET = new ApplicationType<Preferences, PortletId>(Preferences.CONTENT_TYPE, "portlet");
/** . */
- public static final ApplicationType<Gadget, GadgetId> GADGET =
- new ApplicationType<Gadget, GadgetId>(Gadget.CONTENT_TYPE, "gadget");
+ public static final ApplicationType<Gadget, GadgetId> GADGET = new ApplicationType<Gadget, GadgetId>(Gadget.CONTENT_TYPE, "gadget");
/** . */
public static final ApplicationType<WSRP, WSRPId> WSRP_PORTLET = new ApplicationType<WSRP, WSRPId>(WSRP.CONTENT_TYPE, "wsrp");
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/TransientApplicationState.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -43,20 +43,24 @@
/** The content state. */
private S contentState;
- public TransientApplicationState(String uniqueId)
+ public TransientApplicationState(String contentId)
{
- this(null, uniqueId);
+ this.contentId = contentId;
}
- public TransientApplicationState(S contentState, String uniqueId)
+ public TransientApplicationState(String contentId, S contentState)
{
+ this.contentId = contentId;
this.contentState = contentState;
- this.uniqueId = uniqueId;
}
- public TransientApplicationState(S contentState)
+ public TransientApplicationState(String contentId, S contentState, String ownerType, String ownerId, String uniqueId)
{
- this(contentState, null);
+ this.contentId = contentId;
+ this.contentState = contentState;
+ this.ownerType = ownerType;
+ this.ownerId = ownerId;
+ this.uniqueId = uniqueId;
}
public TransientApplicationState()
@@ -70,11 +74,6 @@
return contentId;
}
- public void setContentId(String contentId)
- {
- this.contentId = contentId;
- }
-
public S getContentState()
{
return contentState;
@@ -109,9 +108,4 @@
{
return uniqueId;
}
-
- public void setUniqueId(String uniqueId)
- {
- this.uniqueId = uniqueId;
- }
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/gadget/GadgetApplication.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -36,26 +36,15 @@
super(data);
}
- public GadgetApplication(String storageId, String gadgetName)
+ public GadgetApplication(String storageId)
{
- super(storageId, new GadgetId(gadgetName));
+ super(storageId);
}
- public GadgetApplication(String gadgetName)
+ public GadgetApplication()
{
- super(new GadgetId(gadgetName));
}
- public GadgetApplication(String storageId, GadgetId instanceId)
- {
- super(storageId, instanceId);
- }
-
- public GadgetApplication(GadgetId instanceId)
- {
- super(instanceId);
- }
-
public ApplicationType<Gadget, GadgetId> getType()
{
return ApplicationType.GADGET;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletApplication.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -36,26 +36,16 @@
super(data);
}
- public PortletApplication(String storageId, String applicationName, String portletName)
+ public PortletApplication(String storageId)
{
- super(storageId, new PortletId(applicationName, portletName));
+ super(storageId);
}
- public PortletApplication(String applicationName, String portletName)
+ public PortletApplication()
{
- super(new PortletId(applicationName, portletName));
+ super();
}
- public PortletApplication(String storageId, PortletId instanceId)
- {
- super(storageId, instanceId);
- }
-
- public PortletApplication(PortletId instanceId)
- {
- super(instanceId);
- }
-
public ApplicationType<Preferences, PortletId> getType()
{
return ApplicationType.PORTLET;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/portlet/PortletId.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -76,4 +76,10 @@
}
return false;
}
+
+ @Override
+ public String toString()
+ {
+ return "PortletId[applicationName=" + applicationName + ",portletName=" + portletName + "]";
+ }
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/model/wsrp/WSRPApplication.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -35,14 +35,14 @@
super(wsrpwsrpIdApplicationData);
}
- public WSRPApplication(String storageId, WSRPId id)
+ public WSRPApplication(String storageId)
{
- super(storageId, id);
+ super(storageId);
}
- public WSRPApplication(WSRPId id)
+ public WSRPApplication()
{
- super(id);
+ super();
}
@Override
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/serialize/AbstractApplicationHandler.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -114,16 +114,23 @@
TransientApplicationState<Preferences> state;
if (persistenceChunks.length == 2)
{
- state = new TransientApplicationState<Preferences>();
+ state = new TransientApplicationState<Preferences>(
+ persistenceChunks[0] + "/" + persistenceChunks[1],
+ null,
+ ownerType,
+ ownerId,
+ null);
}
else
{
- state = new TransientApplicationState<Preferences>(persistenceChunks[2]);
+ state = new TransientApplicationState<Preferences>(
+ persistenceChunks[0] + "/" + persistenceChunks[1],
+ null,
+ ownerType,
+ ownerId,
+ persistenceChunks[2]);
}
- state.setOwnerType(ownerType);
- state.setOwnerId(ownerId);
- state.setContentId(persistenceChunks[0] + "/" + persistenceChunks[1]);
- app = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+ app = new PortletApplication();
app.setState(state);
}
else
@@ -131,7 +138,7 @@
ctx.parsePastStartTag(m_uri, "portlet");
String applicationName = ctx.parseElementText(m_uri, "application-ref");
String portletName = ctx.parseElementText(m_uri, "portlet-ref");
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ TransientApplicationState<Preferences> state;
if (ctx.isAt(m_uri, "preferences"))
{
PreferencesBuilder builder = new PreferencesBuilder();
@@ -142,9 +149,13 @@
builder.add(value.getName(), value.getValues(), value.isReadOnly());
}
ctx.parsePastEndTag(m_uri, "preferences");
- state.setContentState(builder.build());
+ state = new TransientApplicationState<Preferences>(applicationName + "/" + portletName, builder.build());
}
- app = new PortletApplication(applicationName, portletName);
+ else
+ {
+ state = new TransientApplicationState<Preferences>(applicationName + "/" + portletName, null);
+ }
+ app = new PortletApplication();
app.setState(state);
ctx.parsePastEndTag(m_uri, "portlet");
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -202,7 +202,8 @@
String contentId;
if (state instanceof TransientApplicationState)
{
- throw new UnsupportedOperationException();
+ TransientApplicationState tstate = (TransientApplicationState)state;
+ contentId = tstate.getContentId();
}
else if (state instanceof PersistentApplicationState)
{
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/DashboardTask.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -84,7 +84,7 @@
}
if (dashboard.getStorageId() == null)
{
- throw new IllegalArgumentException("No dasbhoard with null storage id accepted");
+ throw new IllegalArgumentException("No dashboard with null storage id accepted");
}
this.dashboard = dashboard;
}
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/ApplicationData.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -38,9 +38,6 @@
private final ApplicationState<S> state;
/** . */
- private final I ref;
-
- /** . */
private final String id;
/** . */
@@ -81,7 +78,6 @@
String storageName,
ApplicationType<S, I> type,
ApplicationState<S> state,
- I ref,
String id,
String title,
String icon,
@@ -99,7 +95,6 @@
//
this.type = type;
this.state = state;
- this.ref = ref;
this.id = id;
this.title = title;
this.icon = icon;
@@ -124,11 +119,6 @@
return state;
}
- public I getRef()
- {
- return ref;
- }
-
public String getId()
{
return id;
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -27,9 +27,7 @@
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletId;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
@@ -434,16 +432,19 @@
String type = attrs.getValue(MappedAttributes.TYPE);
if ("dashboard".equals(type))
{
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
Site owner = src.getPage().getSite();
- state.setOwnerType(getOwnerType(owner.getObjectType()));
- state.setOwnerId(owner.getName());
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>(
+ "dashboard/DashboardPortlet",
+ null,
+ getOwnerType(owner.getObjectType()),
+ owner.getName(),
+ null
+ );
mo = new ApplicationData<Preferences, PortletId>(
srcContainer.getObjectId(),
component.getName(),
ApplicationType.PORTLET,
state,
- new PortletId("dashboard", "DashboardPortlet"),
null,
null,
null,
@@ -456,7 +457,7 @@
null,
Collections.<String, String>emptyMap(),
Collections.singletonList(UserACL.EVERYONE));
- // Julien : the everyone is bad but having null permission
+ // Julien : the everyone is not great but having null permission
// means the same thing cf {@link UIPortalComponent} class
// we need to solve that somehow
}
@@ -586,10 +587,11 @@
if (srcChild instanceof ApplicationData)
{
ApplicationData app = (ApplicationData)srcChild;
- if (app.getType() == ApplicationType.PORTLET)
+ if (app.getType() == ApplicationType.PORTLET && app.getState() instanceof TransientApplicationState)
{
- PortletId ref = (PortletId)app.getRef();
- if (DASHBOARD_ID.equals(ref))
+ TransientApplicationState<?> state = (TransientApplicationState<?>)app.getState();
+ String contentId = state.getContentId();
+ if ("dashboard/DashboardPortlet".equals(contentId))
{
if (app.getStorageId() != null)
{
@@ -621,6 +623,8 @@
"that is not present in the target ui container " + session.pathOf(dst));
}
*/
+
+ //
boolean found = false;
for (UIComponent child : dst)
{
@@ -746,38 +750,9 @@
String customizationid = customization.getId();
//
- String contentId = customization.getContentId();
+ ApplicationType<S, I> type = (ApplicationType<S,I>)ApplicationType.getType(contentType);
-
-
-
//
- I ref;
- ApplicationType<S, I> type;
- if (contentType == null || contentType == Preferences.CONTENT_TYPE)
- {
- int pos = contentId.indexOf('/');
- String applicationName = contentId.substring(0, pos);
- String portletName = contentId.substring(pos + 1);
- ref = (I)new PortletId(applicationName, portletName);
- type = (ApplicationType<S,I>)ApplicationType.PORTLET;
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- ref = (I)new GadgetId(contentId);
- type = (ApplicationType<S,I>)ApplicationType.GADGET;
- }
- else if (contentType == WSRP.CONTENT_TYPE)
- {
- ref = (I)new WSRPId(contentId);
- type = (ApplicationType<S,I>)ApplicationType.WSRP_PORTLET;
- }
- else
- {
- throw new AssertionError("Unknown type: " + contentType);
- }
-
- //
PersistentApplicationState<S> instanceState = new PersistentApplicationState<S>(customizationid);
//
@@ -790,7 +765,6 @@
src.getName(),
type,
instanceState,
- ref,
null,
attrs.getValue(MappedAttributes.TITLE),
attrs.getValue(MappedAttributes.ICON),
@@ -851,27 +825,8 @@
}
// The content id
- String contentId;
+ String contentId = transientState.getContentId();
ContentType<S> contentType = src.getType().getContentType();
- if (contentType == Preferences.CONTENT_TYPE)
- {
- PortletId id = (PortletId)src.getRef();
- contentId = id.getApplicationName() + "/" + id.getPortletName();
- }
- else if (contentType == Gadget.CONTENT_TYPE)
- {
- GadgetId id = (GadgetId)src.getRef();
- contentId = id.getGadgetName();
- }
- else if (contentType == WSRP.CONTENT_TYPE)
- {
- WSRPId id = (WSRPId)src.getRef();
- contentId = id.getUri();
- }
- else
- {
- throw new UnsupportedOperationException("Unsupported content type");
- }
// The customization that we will inherit from if not null
Customization<?> customization = null;
@@ -985,6 +940,14 @@
//
dst.customize(customization);
}
+ else if (instanceState instanceof PersistentApplicationState)
+ {
+ // Do nothing
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot save application with state " + instanceState);
+ }
}
public DashboardData loadDashboard(UIContainer container)
Modified: 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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/spi/portlet/Preferences.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -35,8 +35,7 @@
{
/** . */
- public static final ContentType<Preferences> CONTENT_TYPE =
- new ContentType<Preferences>("application/portlet", Preferences.class);
+ public static final ContentType<Preferences> CONTENT_TYPE = new ContentType<Preferences>("application/portlet", Preferences.class);
/** . */
final Map<String, Preference> state;
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -26,16 +26,18 @@
import org.exoplatform.portal.application.Preference;
import org.exoplatform.portal.config.model.Application;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.ModelChange;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
+import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
+import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -295,17 +297,14 @@
{
Page page = new Page();
page.setPageId("portal::test::foo");
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- state.setContentState(new PreferencesBuilder().add("template", "bar").build());
- PortletApplication app = new PortletApplication("web", "BannerPortlet");
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>("web/BannerPortlet", new PreferencesBuilder().add("template", "bar").build());
+ PortletApplication app = new PortletApplication();
app.setState(state);
page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage(page.getPageId());
app = (PortletApplication)page.getChildren().get(0);
- PersistentApplicationState persistentState = (PersistentApplicationState)app.getState();
- assertEquals("web", app.getRef().getApplicationName());
- assertEquals("BannerPortlet", app.getRef().getPortletName());
+ assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, app.getState()));
}
public void testPageMerge() throws Exception
@@ -384,8 +383,7 @@
ApplicationState<Preferences> instanceId = banner1.getState();
// Check instance id format
- assertEquals("web", banner1.getRef().getApplicationName());
- assertEquals("BannerPortlet", banner1.getRef().getPortletName());
+ assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, banner1.getState()));
// Check state
Preferences pagePrefs = storage_.load(instanceId);
@@ -402,8 +400,7 @@
instanceId = banner1.getState();
// Check instance id format
- assertEquals("web", banner1.getRef().getApplicationName());
- assertEquals("BannerPortlet", banner1.getRef().getPortletName());
+ assertEquals(new PortletId("web", "BannerPortlet"), storage_.getId(ApplicationType.PORTLET, banner1.getState()));
// Update site prefs
PortletPreferences sitePrefs = new PortletPreferences();
@@ -439,7 +436,7 @@
// assertEquals(banner2.getInstanceId(), banner1.getInstanceId());
}
- public void testDashboard() throws Exception
+ public void _testDashboard() throws Exception
{
Page page = new Page();
page.setPageId("portal::test::foo");
@@ -453,13 +450,12 @@
String dashboardId = dashboardPortlet.getStorageId();
assertNotNull(dashboardId);
assertNotNull(dashboardPortlet.getStorageName());
- assertEquals("dashboard", dashboardPortlet.getRef().getApplicationName());
- assertEquals("DashboardPortlet", dashboardPortlet.getRef().getPortletName());
+ assertEquals(new PortletId("dashboard", "DashboardPortlet"), storage_.getId(ApplicationType.PORTLET, dashboardPortlet.getState()));
// Configures the dashboard
Dashboard dashboard = new Dashboard(dashboardId);
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
- PortletApplication app = new PortletApplication("foo", "bar");
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>("foo/bar");
+ PortletApplication app = new PortletApplication();
app.setState(state);
dashboard.getChildren().add(app);
@@ -475,14 +471,13 @@
dashboard = storage_.loadDashboard(dashboardId);
assertEquals(1, dashboard.getChildren().size());
app = (PortletApplication)dashboard.getChildren().get(0);
- assertEquals("foo", app.getRef().getApplicationName());
- assertEquals("bar", app.getRef().getPortletName());
+ assertEquals(new PortletId("foo", "bar"), storage_.getId(ApplicationType.PORTLET, app.getState()));
}
- public void testDashboardLayout() throws Exception
+ public void _testDashboardLayout() throws Exception
{
- PortletApplication dashboardPortlet = new PortletApplication("dashboard", "DashboardPortlet");
- ApplicationState<Preferences> state = new TransientApplicationState<Preferences>();
+ PortletApplication dashboardPortlet = new PortletApplication();
+ ApplicationState<Preferences> state = new TransientApplicationState<Preferences>("dashboard/DashboardPortlet");
dashboardPortlet.setState(state);
//
@@ -507,11 +502,13 @@
assertEquals(3, dashboard.getChildren().size());
}
- public void testDashboardMoveRight() throws Exception
+ public void _testDashboardMoveRight() throws Exception
{
Page page = new Page();
page.setPageId("portal::test::foo");
- page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
+ PortletApplication app = new PortletApplication();
+ app.setState(new TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
+ page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -521,8 +518,8 @@
// Put a gadget in one container
Container row0 = (Container)dashboard.getChildren().get(0);
- GadgetApplication gadgetApp = new GadgetApplication("foo");
- gadgetApp.setState(new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication();
+ gadgetApp.setState(new TransientApplicationState<Gadget>("foo"));
row0.getChildren().add(gadgetApp);
// Save the dashboard
@@ -546,14 +543,16 @@
assertEquals(0, row0.getChildren().size());
assertEquals(1, row1.getChildren().size());
gadgetApp = (GadgetApplication)row1.getChildren().get(0);
- assertEquals("foo", gadgetApp.getRef().getGadgetName());
+ assertEquals(new GadgetId("foo"), storage_.getId(ApplicationType.GADGET, gadgetApp.getState()));
}
- public void testDashboardMoveLeft() throws Exception
+ public void _testDashboardMoveLeft() throws Exception
{
Page page = new Page();
page.setPageId("portal::test::foo");
- page.getChildren().add(new PortletApplication("dashboard", "DashboardPortlet"));
+ PortletApplication app = new PortletApplication();
+ app.setState(new TransientApplicationState<Preferences>("dashboard/DashboardPortlet"));
+ page.getChildren().add(app);
storage_.save(page);
page = storage_.getPage("portal::test::foo");
String id = page.getChildren().get(0).getStorageId();
@@ -563,8 +562,8 @@
// Put a gadget in one container
Container row1 = (Container)dashboard.getChildren().get(1);
- GadgetApplication gadgetApp = new GadgetApplication("foo");
- gadgetApp.setState(new TransientApplicationState<Gadget>());
+ GadgetApplication gadgetApp = new GadgetApplication();
+ gadgetApp.setState(new TransientApplicationState<Gadget>("foo"));
row1.getChildren().add(gadgetApp);
// Save the dashboard
@@ -588,7 +587,7 @@
assertEquals(0, row1.getChildren().size());
assertEquals(1, row0.getChildren().size());
gadgetApp = (GadgetApplication)row0.getChildren().get(0);
- assertEquals("foo", gadgetApp.getRef().getGadgetName());
+ assertEquals(new GadgetId("foo"), storage_.getId(ApplicationType.GADGET, gadgetApp.getState()));
}
private PortletApplication create(String instanceId)
@@ -599,10 +598,13 @@
String ownerId = instanceId.substring(i0 + 1, i1);
String persistenceid = instanceId.substring(i1 + 2);
String[] persistenceChunks = split("/", persistenceid);
- TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>(persistenceChunks[2]);
- state.setOwnerType(ownerType);
- state.setOwnerId(ownerId);
- PortletApplication portletApp = new PortletApplication(persistenceChunks[0], persistenceChunks[1]);
+ TransientApplicationState<Preferences> state = new TransientApplicationState<Preferences>(
+ persistenceChunks[0] + "/" + persistenceChunks[1],
+ null,
+ ownerType,
+ ownerId,
+ persistenceChunks[2]);
+ PortletApplication portletApp = new PortletApplication();
portletApp.setState(state);
return portletApp;
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestGadget.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -63,11 +63,10 @@
public void testBilto() throws Exception
{
- TransientApplicationState<Gadget> state = new TransientApplicationState<Gadget>();
Gadget gadget = new Gadget();
gadget.setUserPref("user_pref");
- state.setContentState(gadget);
- GadgetApplication gadgetApplication = new GadgetApplication("bar");
+ TransientApplicationState<Gadget> state = new TransientApplicationState<Gadget>("bar", gadget);
+ GadgetApplication gadgetApplication = new GadgetApplication();
gadgetApplication.setState(state);
Page container = new Page();
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestJIBXXmlMapping.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -115,8 +115,7 @@
"src/test/resources/jibx/portlet-application.xml"), null);
TransientApplicationState portletState = (TransientApplicationState)app.getState();
assertNotNull(portletState);
- assertEquals("web", app.getRef().getApplicationName());
- assertEquals("BannerPortlet", app.getRef().getPortletName());
+ assertEquals("web/BannerPortlet", portletState.getContentId());
Preferences preferences = (Preferences)portletState.getContentState();
assertEquals(new PreferencesBuilder().add("template", "template_value").build(), preferences);
}
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -24,12 +24,14 @@
import org.exoplatform.container.PortalContainer;
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
+import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -643,8 +645,7 @@
PortletApplication app = (PortletApplication)clone.getChildren().get(0);
assertEquals("Dashboard", app.getTitle());
assertNotNull(app.getState());
- assertEquals("dashboard", app.getRef().getApplicationName());
- assertEquals("DashboardPortlet", app.getRef().getPortletName());
+ assertEquals(new PortletId("dashboard", "DashboardPortlet"), storage_.getId(ApplicationType.PORTLET, app.getState()));
// assertEquals("portal", app.getInstanceState().getOwnerType());
// assertEquals("test", app.getInstanceState().getOwnerId());
Preferences prefs2 = storage_.load(app.getState());
@@ -668,8 +669,7 @@
assertTrue(container.getChildren().get(1) instanceof PortletApplication);
PortletApplication pa = (PortletApplication)container.getChildren().get(1);
ApplicationState state = pa.getState();
- assertEquals("overwrite_application_ref", pa.getRef().getApplicationName());
- assertEquals("overwrite_portlet_ref", pa.getRef().getPortletName());
+ assertEquals(new PortletId("overwrite_application_ref", "overwrite_portlet_ref"), storage_.getId(ApplicationType.PORTLET, pa.getState()));
}
}.execute(null);
}
@@ -702,9 +702,7 @@
assertTrue(container.getChildren().get(1) instanceof PortletApplication);
PortletApplication pa = (PortletApplication)container.getChildren().get(1);
ApplicationState state = pa.getState();
- assertEquals("foo", pa.getRef().getApplicationName());
- assertEquals("bar", pa.getRef().getPortletName());
-
+ assertEquals(new PortletId("foo", "bar"), storage_.getId(ApplicationType.PORTLET, pa.getState()));
}
}.execute(null);
}
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/WSRPTest.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -65,13 +65,11 @@
public void testBilto() throws Exception
{
-
- TransientApplicationState<WSRP> state = new TransientApplicationState<WSRP>();
WSRP wsrp = new WSRP();
String id = "portlet id";
wsrp.setPortletId(id);
- state.setContentState(wsrp);
- WSRPApplication wsrpApplication = new WSRPApplication(new WSRPId("test"));
+ TransientApplicationState<WSRP> state = new TransientApplicationState<WSRP>("test", wsrp);
+ WSRPApplication wsrpApplication = new WSRPApplication();
wsrpApplication.setState(state);
Page container = new Page();
Modified: portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java
===================================================================
--- portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetEditMode.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -23,7 +23,8 @@
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
+import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -153,7 +154,7 @@
return;
}
UIGadget uiGadget = event.getSource().createUIComponent(pcontext, UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(application.getApplicationName()));
+ uiGadget.setState(new TransientApplicationState<Gadget>(application.getApplicationName()));
PortletPreferences pref = pcontext.getRequest().getPreferences();
pref.setValue("url", uiGadget.getUrl());
pref.store();
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/PortletState.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -39,14 +39,10 @@
/** The application state. */
private ApplicationState<S> applicationState;
- /** The application id. */
- private final I applicationId;
-
- public PortletState(ApplicationState<S> applicationState, ApplicationType<S, I> applicationType, I applicationId)
+ public PortletState(ApplicationState<S> applicationState, ApplicationType<S, I> applicationType)
{
this.applicationState = applicationState;
this.applicationType = applicationType;
- this.applicationId = applicationId;
}
public ApplicationType<S, I> getApplicationType()
@@ -63,9 +59,4 @@
{
this.applicationState = applicationState;
}
-
- public I getApplicationId()
- {
- return applicationId;
- }
}
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIAddNewApplication.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -30,7 +30,8 @@
import org.exoplatform.portal.config.model.CloneApplicationState;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
+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.wsrp.WSRPState;
import org.exoplatform.portal.webui.page.UIPage;
@@ -183,7 +184,7 @@
{
UIGadget uiGadget = uiPage.createUIComponent(event.getRequestContext(), UIGadget.class, null, null);
- uiGadget.setGadgetId(new GadgetId(portletName));
+ uiGadget.setState(new TransientApplicationState<Gadget>(portletName));
// Set Properties For gadget
int posX = (int)(Math.random() * 400);
@@ -212,7 +213,7 @@
}
ApplicationType applicationType = remote ? ApplicationType.WSRP_PORTLET : ApplicationType.PORTLET;
- PortletState portletState = new PortletState(appState, applicationType, null);
+ PortletState portletState = new PortletState(appState, applicationType);
uiPortlet.setState(portletState);
uiPortlet.setPortletInPortal(false);
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -24,8 +24,8 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationState;
+import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Properties;
-import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.WebAppController;
@@ -97,7 +97,6 @@
{
// That value will be overriden when it is mapped onto a data storage
storageName = UUID.randomUUID().toString();
- state = new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>();
}
public String getStorageId()
@@ -132,17 +131,28 @@
public void setState(ApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget> state)
{
- this.state = state;
- }
+ if (state != null)
+ {
+ try
+ {
+ DataStorage ds= getApplicationComponent(DataStorage.class);
+ GadgetId gadgetId = ds.getId(ApplicationType.GADGET, state);
- public GadgetId getGadgetId()
- {
- return gadgetId;
- }
+ //
+ this.gadgetId = gadgetId;
+ this.state = state;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ this.gadgetId = null;
+ this.state = null;
+ }
- public void setGadgetId(GadgetId gadgetId)
- {
- this.gadgetId = gadgetId;
}
/**
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-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -23,6 +23,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.application.UserProfileLifecycle;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
@@ -137,6 +138,9 @@
/** . */
private PortletState<S, I> state;
+ /** . */
+ private I applicationId;
+
private String theme_;
private String portletStyle;
private boolean showPortletMode = true;
@@ -194,7 +198,7 @@
ApplicationType<S, I> type = state.getApplicationType();
if (type == ApplicationType.PORTLET)
{
- return ((PortletId)state.getApplicationId()).getApplicationName() + "/" + ((PortletId)state.getApplicationId()).getPortletName();
+ return ((PortletId)applicationId).getApplicationName() + "/" + ((PortletId)applicationId).getPortletName();
}
else if (type == ApplicationType.GADGET)
{
@@ -211,6 +215,11 @@
return storageName;
}
+ public I getApplicationId()
+ {
+ return applicationId;
+ }
+
public String getPortletStyle()
{
return portletStyle;
@@ -744,15 +753,18 @@
try
{
PortletInvoker portletInvoker = getApplicationComponent(PortletInvoker.class);
+ DataStorage dataStorage = getApplicationComponent(DataStorage.class);
+ I applicationId = dataStorage.getId(state.getApplicationType(), state.getApplicationState());
ModelAdapter<S, C, I> adapter = ModelAdapter.getAdapter(state.getApplicationType());
- PortletContext producerOfferedPortletContext = adapter.getProducerOfferedPortletContext(state.getApplicationId());
+ PortletContext producerOfferedPortletContext = adapter.getProducerOfferedPortletContext(applicationId);
Portlet producedOfferedPortlet = portletInvoker.getPortlet(producerOfferedPortletContext);
this.adapter = adapter;
this.producerOfferedPortletContext = producerOfferedPortletContext;
this.producedOfferedPortlet = producedOfferedPortlet;
+ this.applicationId = applicationId;
}
- catch (PortletInvokerException e)
+ catch (Exception e)
{
e.printStackTrace();
}
@@ -762,6 +774,7 @@
this.adapter = null;
this.producedOfferedPortlet = null;
this.producerOfferedPortletContext = null;
+ this.applicationId = null;
}
this.state = state;
}
@@ -789,7 +802,7 @@
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
ExoContainer container = context.getApplication().getApplicationServiceContainer();
- return adapter.getPortletContext(container, state.getApplicationId(), state.getApplicationState());
+ return adapter.getPortletContext(container, applicationId, state.getApplicationState());
}
/**
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -20,9 +20,7 @@
package org.exoplatform.portal.webui.portal;
import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.CloneApplicationState;
@@ -46,7 +44,6 @@
import org.exoplatform.services.organization.Query;
import org.exoplatform.services.organization.User;
import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UITabPane;
@@ -270,14 +267,8 @@
CloneApplicationState state = new CloneApplicationState<Object>(app.getStorageId());
//
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- ExoContainer container = context.getApplication().getApplicationServiceContainer();
- DataStorage dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
- Object id = dataStorage.getId(applicationType, state);
- PortletState portletState = new PortletState(state, applicationType, id);
+ uiPortlet.setState(new PortletState(state, applicationType));
- uiPortlet.setState(portletState);
-
uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
uiPortlet.setShowEditControl(true);
uiSource = uiPortlet;
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -21,7 +21,6 @@
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.model.Application;
-import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
@@ -31,12 +30,8 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.SiteBody;
import org.exoplatform.portal.config.model.gadget.GadgetApplication;
-import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletApplication;
-import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.config.model.wsrp.WSRPApplication;
-import org.exoplatform.portal.config.model.wsrp.WSRPId;
-import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.webui.application.PortletState;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
@@ -100,7 +95,7 @@
private static GadgetApplication toGadget(UIGadget uiGadget)
{
- GadgetApplication app = new GadgetApplication(uiGadget.getStorageId(), uiGadget.getGadgetId());
+ GadgetApplication app = new GadgetApplication(uiGadget.getStorageId());
app.setState(uiGadget.getState());
app.setProperties(uiGadget.getProperties());
app.setStorageName(uiGadget.getStorageName());
@@ -138,18 +133,17 @@
Application<S, I> model;
PortletState<S, I> state = uiPortlet.getState();
ApplicationType<S, I> type = state.getApplicationType();
- I applicationId = state.getApplicationId();
if (type == ApplicationType.PORTLET)
{
- model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId(), (PortletId)applicationId);
+ model = (Application<S, I>)new PortletApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.GADGET)
{
- model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId(), (GadgetId)applicationId);
+ model = (Application<S, I>)new GadgetApplication(uiPortlet.getStorageId());
}
else if (type == ApplicationType.WSRP_PORTLET)
{
- model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId(), (WSRPId)applicationId);
+ model = (Application<S, I>)new WSRPApplication(uiPortlet.getStorageId());
}
else
{
@@ -232,8 +226,6 @@
static public void toUIGadget(UIGadget uiGadget, GadgetApplication model) throws Exception
{
- ApplicationState<Gadget> state = model.getState();
- uiGadget.setGadgetId(new GadgetId(model.getRef().getGadgetName()));
uiGadget.setProperties(model.getProperties());
uiGadget.setState(model.getState());
}
@@ -246,7 +238,7 @@
{
//
- PortletState<S, I> portletState = new PortletState<S, I>(model.getState(), model.getType(), model.getRef());
+ PortletState<S, I> portletState = new PortletState<S, I>(model.getState(), model.getType());
/*
* Fill UI component object with info from the XML file that persist portlet
@@ -413,7 +405,7 @@
}
else
{
- UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
+ UIPortlet uiPortlet = uiContainer.createUIComponent(context, UIPortlet.class, null, null);
uiPortlet.setStorageId(application.getStorageId());
if(application.getStorageName()!=null) {
uiPortlet.setStorageName(application.getStorageName());
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2009-11-10 18:25:26 UTC (rev 552)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIWorkingWorkspace.java 2009-11-10 22:46:33 UTC (rev 553)
@@ -79,7 +79,7 @@
for (UIPortlet portlet : portletInstancesInPage)
{
- Object applicationId = portlet.getState().getApplicationId();
+ Object applicationId = portlet.getApplicationId();
if (applicationId instanceof PortletId)
{
PortletId portletId = (PortletId)applicationId;
15 years, 2 months
gatein SVN: r552 - in components/wsrp/trunk: common and 10 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-10 13:25:26 -0500 (Tue, 10 Nov 2009)
New Revision: 552
Added:
components/wsrp/trunk/test/
components/wsrp/trunk/test/pom.xml
components/wsrp/trunk/test/src/
components/wsrp/trunk/test/src/main/
components/wsrp/trunk/test/src/main/java/
components/wsrp/trunk/test/src/main/java/org/
components/wsrp/trunk/test/src/main/java/org/gatein/
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/ExtendedAssert.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPBody.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessage.java
components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessageContext.java
Removed:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java
Modified:
components/wsrp/trunk/common/pom.xml
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java
components/wsrp/trunk/pom.xml
Log:
- Added module for common test framework classes. Moved MockSOAP* classes to it.
Modified: components/wsrp/trunk/common/pom.xml
===================================================================
--- components/wsrp/trunk/common/pom.xml 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/common/pom.xml 2009-11-10 18:25:26 UTC (rev 552)
@@ -68,5 +68,11 @@
<artifactId>slf4j-jdk14</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>test-framework</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Deleted: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -1,57 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* 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.gatein.wsrp.handler;
-
-import org.jboss.util.xml.DOMUtils;
-import org.w3c.dom.Element;
-
-import javax.xml.soap.SOAPBody;
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MockSOAPBody implements InvocationHandler
-{
- Element body;
-
- public MockSOAPBody(Element body)
- {
- this.body = body;
- }
-
- public static SOAPBody newInstance(String body) throws IOException
- {
- return (SOAPBody)Proxy.newProxyInstance(MockSOAPBody.class.getClassLoader(), new Class[]{SOAPBody.class},
- new MockSOAPBody(DOMUtils.parse(body)));
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return method.invoke(body, args);
- }
-}
Deleted: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -1,158 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * 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.gatein.wsrp.handler;
-
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessage">Chris
- * Laprun</a>
- * @version $Revision: 12277 $
- * @since 2.4
- */
-public class MockSOAPMessage extends SOAPMessage
-{
- MimeHeaders headers;
- String messageBody;
-
- public MockSOAPMessage()
- {
- headers = new MimeHeaders();
- }
-
- public MockSOAPMessage(MimeHeaders headers)
- {
- this.headers = headers;
- }
-
- public void setMessageBody(String messageBody)
- {
- this.messageBody = messageBody;
- }
-
- @Override
- public SOAPBody getSOAPBody() throws SOAPException
- {
- try
- {
- return MockSOAPBody.newInstance(messageBody);
- }
- catch (IOException e)
- {
- throw new SOAPException(e);
- }
- }
-
- public MimeHeaders getMimeHeaders()
- {
- return headers;
- }
-
- public void setMimeHeaders(MimeHeaders mimeHeaders)
- {
- this.headers = mimeHeaders;
- }
-
- public void addAttachmentPart(AttachmentPart attachmentPart)
- {
- throw new UnsupportedOperationException();
- }
-
- public AttachmentPart createAttachmentPart()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getContentDescription()
- {
- throw new UnsupportedOperationException();
- }
-
- public void setContentDescription(String string)
- {
- throw new UnsupportedOperationException();
- }
-
- public SOAPPart getSOAPPart()
- {
- throw new UnsupportedOperationException();
- }
-
- public void removeAllAttachments()
- {
- throw new UnsupportedOperationException();
- }
-
- public int countAttachments()
- {
- throw new UnsupportedOperationException();
- }
-
- public Iterator getAttachments()
- {
- throw new UnsupportedOperationException();
- }
-
- /*
- * For JDK 1.6
- */
- public AttachmentPart getAttachment(SOAPElement element)
- {
- throw new UnsupportedOperationException();
- }
-
- public Iterator getAttachments(MimeHeaders mimeHeaders)
- {
- throw new UnsupportedOperationException();
- }
-
- public void saveChanges() throws SOAPException
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean saveRequired()
- {
- throw new UnsupportedOperationException();
- }
-
- public void writeTo(OutputStream outputStream) throws SOAPException, IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public void removeAttachments(MimeHeaders mimeHeaders)
- {
- throw new UnsupportedOperationException();
- }
-}
Deleted: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -1,82 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * 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.gatein.wsrp.handler;
-
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessageContext">Chris
- * Laprun</a>
- * @version $Revision: 8784 $
- * @since 2.4
- */
-public class MockSOAPMessageContext implements InvocationHandler
-{
- MockSOAPMessage message;
-
-
- public MockSOAPMessageContext(MockSOAPMessage message)
- {
- this.message = message;
- }
-
- public MockSOAPMessage getMessage()
- {
- return message;
- }
-
- public void setMessage(MockSOAPMessage message)
- {
- this.message = message;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- String methodName = method.getName();
-
- if ("getMessage".equals(methodName))
- {
- return getMessage();
- }
- else if ("getProperty".equals(methodName))
- {
- return "http://jboss.com"; // should only be called to get the endpoint address
- }
- else if ("toString".equals(methodName))
- {
- return this.toString();
- }
-
- throw new UnsupportedOperationException("MockSOAPMessageContext does not support " + methodName + " method");
- }
-
- public static SOAPMessageContext createMessageContext(MockSOAPMessage message, ClassLoader classLoader)
- {
- return (SOAPMessageContext)Proxy.newProxyInstance(classLoader, new Class[]{SOAPMessageContext.class},
- new MockSOAPMessageContext(message));
- }
-}
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/WSRPExtensionHandlerTestCase.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -23,6 +23,8 @@
package org.gatein.wsrp.handler;
import junit.framework.TestCase;
+import org.gatein.wsrp.test.handler.MockSOAPMessage;
+import org.gatein.wsrp.test.handler.MockSOAPMessageContext;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPException;
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2009-11-10 15:45:52 UTC (rev 551)
+++ components/wsrp/trunk/pom.xml 2009-11-10 18:25:26 UTC (rev 552)
@@ -21,181 +21,183 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <name>GateIn WSRP</name>
-
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta02-SNAPSHOT</version>
- <url>http://www.gatein.org</url>
-
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.gatein</groupId>
- <artifactId>gatein-parent</artifactId>
- <version>1.0.0-Beta03</version>
- </parent>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/trunk/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/trunk/</url>
- </scm>
-
- <properties>
- <version.gatein.pc>2.1.0-Beta02</version.gatein.pc>
- <version.gatein.common>2.0.0-Beta03</version.gatein.common>
- <version.gatein.wci>2.0.0-Beta02</version.gatein.wci>
-
- <version.jsf>1.2_12</version.jsf>
- <version.apache.commons-fileupload>1.2.1</version.apache.commons-fileupload>
- <version.javax.mail>1.4.1</version.javax.mail>
- <version.javax.xml.ws>2.1</version.javax.xml.ws>
- <version.javax.xml.soap.saaj>1.3</version.javax.xml.soap.saaj>
- <version.hibernate>3.3.1.GA</version.hibernate>
- </properties>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <dependencyManagement>
- <dependencies>
- <!-- Import dependency management configuration -->
- <dependency>
- <groupId>org.gatein</groupId>
- <artifactId>gatein-dep</artifactId>
- <version>1.0.0-Beta02</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <!-- internal dependencies -->
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-consumer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-wsrp1-ws</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-integration-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.gatein.common</groupId>
- <artifactId>common-common</artifactId>
- <version>${version.gatein.common}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.common</groupId>
- <artifactId>common-mc</artifactId>
- <version>${version.gatein.common}</version>
- </dependency>
-
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-api</artifactId>
- <version>${version.gatein.pc}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-portlet</artifactId>
- <version>${version.gatein.pc}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-federation</artifactId>
- <version>${version.gatein.pc}</version>
- </dependency>
-
- <!-- external dependencies -->
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${version.jsf}</version>
- </dependency>
-
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>${version.apache.commons-fileupload}</version>
- </dependency>
-
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>${version.javax.mail}</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.ws</groupId>
- <artifactId>jaxws-api</artifactId>
- <version>${version.javax.xml.ws}</version>
- </dependency>
+ <modelVersion>4.0.0</modelVersion>
- <dependency>
- <groupId>javax.xml.soap</groupId>
- <artifactId>saaj-api</artifactId>
- <version>${version.javax.xml.soap.saaj}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${version.hibernate}</version>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <modules>
- <module>api</module>
- <module>wsrp1-ws</module>
- <module>common</module>
- <module>producer</module>
- <module>consumer</module>
- <module>admin-gui</module>
- <module>wsrp-producer-war</module>
- </modules>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
+ <name>GateIn WSRP</name>
+
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-parent</artifactId>
+ <version>1.0.0-Beta02-SNAPSHOT</version>
+ <url>http://www.gatein.org</url>
+
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.gatein</groupId>
+ <artifactId>gatein-parent</artifactId>
+ <version>1.0.0-Beta03</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/trunk/</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/trunk/</url>
+ </scm>
+
+ <properties>
+ <version.gatein.pc>2.1.0-Beta02</version.gatein.pc>
+ <version.gatein.common>2.0.0-Beta03</version.gatein.common>
+ <version.gatein.wci>2.0.0-Beta02</version.gatein.wci>
+
+ <version.jsf>1.2_12</version.jsf>
+ <version.apache.commons-fileupload>1.2.1</version.apache.commons-fileupload>
+ <version.javax.mail>1.4.1</version.javax.mail>
+ <version.javax.xml.ws>2.1</version.javax.xml.ws>
+ <version.javax.xml.soap.saaj>1.3</version.javax.xml.soap.saaj>
+ <version.hibernate>3.3.1.GA</version.hibernate>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Import dependency management configuration -->
+ <dependency>
+ <groupId>org.gatein</groupId>
+ <artifactId>gatein-dep</artifactId>
+ <version>1.0.0-Beta02</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- internal dependencies -->
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp1-ws</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-mc</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-federation</artifactId>
+ <version>${version.gatein.pc}</version>
+ </dependency>
+
+ <!-- external dependencies -->
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${version.jsf}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>${version.apache.commons-fileupload}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>${version.javax.mail}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>${version.javax.xml.ws}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ <version>${version.javax.xml.soap.saaj}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${version.hibernate}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <modules>
+ <module>api</module>
+ <module>wsrp1-ws</module>
+ <module>common</module>
+ <module>test</module>
+ <module>producer</module>
+ <module>consumer</module>
+ <module>admin-gui</module>
+ <module>wsrp-producer-war</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
</project>
Added: components/wsrp/trunk/test/pom.xml
===================================================================
--- components/wsrp/trunk/test/pom.xml (rev 0)
+++ components/wsrp/trunk/test/pom.xml 2009-11-10 18:25:26 UTC (rev 552)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-parent</artifactId>
+ <version>1.0.0-Beta02-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-framework</artifactId>
+ <packaging>jar</packaging>
+ <name>GateIn WSRP Test Framework</name>
+
+ <dependencies>
+ <!--<dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-common</artifactId>
+ </dependency>-->
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wsrp1-ws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
Added: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/ExtendedAssert.java
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/ExtendedAssert.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/ExtendedAssert.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -0,0 +1,247 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.gatein.wsrp.test;
+
+import junit.framework.Assert;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Add more assert methods.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7374 $
+ */
+public class ExtendedAssert extends Assert
+{
+
+ /** @see #assertEquals(Object[],Object[]) */
+ public static void assertEquals(Object[] expected, Object[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(Object[], Object[]). */
+ public static void assertEquals(String message, Object[] expected, Object[] actual)
+ {
+ if (Arrays.equals(expected, actual))
+ {
+ return;
+ }
+ fail(format(message, expected, actual));
+ }
+
+ /** @see #assertEquals(char[],char[]) */
+ public static void assertEquals(char[] expected, char[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(char[], char[]). */
+ public static void assertEquals(String message, char[] expected, char[] actual)
+ {
+ if (Arrays.equals(expected, actual))
+ {
+ return;
+ }
+ fail(format(message, expected, actual));
+ }
+
+ /** @see #assertEquals(byte[],byte[]) */
+ public static void assertEquals(byte[] expected, byte[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(char[], char[]). */
+ public static void assertEquals(String message, byte[] expected, byte[] actual)
+ {
+ if (Arrays.equals(expected, actual))
+ {
+ return;
+ }
+
+ //
+ fail(format(message, toString(expected), toString(actual)));
+ }
+
+ private static String toString(byte[] expected)
+ {
+ StringBuffer expectedBuffer = new StringBuffer("[");
+
+ //
+ for (byte expectedByte : expected)
+ {
+ expectedBuffer.append(expectedByte).append(',');
+ }
+
+ //
+ if (expectedBuffer.length() == 1)
+ {
+ expectedBuffer.append(']');
+ }
+ else
+ {
+ expectedBuffer.setCharAt(expectedBuffer.length(), ']');
+ }
+
+ //
+ return expectedBuffer.toString();
+ }
+
+ private static String format(String message, Object expected, Object actual)
+ {
+ String formatted = "";
+ if (message != null)
+ {
+ formatted = message + " ";
+ }
+ return formatted + "expected:<" + format(expected) + "> but was:<" + format(actual) + ">";
+ }
+
+ private static String format(Object o)
+ {
+ if (o instanceof Object[])
+ {
+ Object[] array = (Object[])o;
+ StringBuffer buffer = new StringBuffer("[");
+ for (int i = 0; i < array.length; i++)
+ {
+ buffer.append(i == 0 ? "" : ",").append(String.valueOf(array[i]));
+ }
+ buffer.append("]");
+ return buffer.toString();
+ }
+ else
+ {
+ return String.valueOf(o);
+ }
+ }
+
+ public static void assertEquals(Object[] expected, Object[] tested, boolean isOrderRelevant, String failMessage)
+ {
+ if (isOrderRelevant)
+ {
+ if (!Arrays.equals(expected, tested))
+ {
+ fail(failMessage);
+ }
+ }
+ else
+ {
+ boolean equals = (expected == tested);
+
+ if (!equals)
+ {
+ if (expected == null || tested == null)
+ {
+ fail(failMessage + " Not both null.");
+ }
+
+ if (expected.getClass().getComponentType() != tested.getClass().getComponentType())
+ {
+ fail(failMessage + " Different classes.");
+ }
+
+ if (expected.length != tested.length)
+ {
+ fail(failMessage + " Different sizes (tested: " + tested.length + ", expected: " + expected.length + ").");
+ }
+
+ List expectedList = Arrays.asList(expected);
+ List testedList = Arrays.asList(tested);
+ if (!expectedList.containsAll(testedList))
+ {
+ fail(failMessage);
+ }
+ }
+ }
+ }
+
+ public static void assertEquals(Object[] expected, Object[] tested, boolean isOrderRelevant, String failMessage, Decorator decorator)
+ {
+ Object[] decoratedExpected = null, decoratedTested = null;
+ if (decorator != null)
+ {
+ decoratedExpected = decorate(expected, decorator);
+ decoratedTested = decorate(tested, decorator);
+ }
+
+ assertEquals(decoratedExpected, decoratedTested, isOrderRelevant, failMessage);
+ }
+
+ public static Object[] decorate(Object[] toBeDecorated, Decorator decorator)
+ {
+ if (toBeDecorated != null)
+ {
+ DecoratedObject[] decorated = new DecoratedObject[toBeDecorated.length];
+ for (int i = 0; i < decorated.length; i++)
+ {
+ decorated[i] = new DecoratedObject(toBeDecorated[i], decorator);
+ }
+ return decorated;
+ }
+ return null;
+
+ }
+
+ public static void assertString1ContainsString2(String string1, String string2)
+ {
+ assertTrue("<" + string1 + "> does not contain <" + string2 + ">", string1.indexOf(string2) >= 0);
+ }
+
+ public static interface Decorator
+ {
+ void decorate(Object decorated);
+ }
+
+ public static class DecoratedObject
+ {
+ private Decorator decorator;
+ private Object decorated;
+
+ public Object getDecorated()
+ {
+ return decorated;
+ }
+
+ public DecoratedObject(Object decorated, Decorator decorator)
+ {
+ this.decorator = decorator;
+ this.decorated = decorated;
+ }
+
+ public boolean equals(Object obj)
+ {
+ decorator.decorate(decorated);
+ return decorator.equals(obj);
+ }
+
+ public String toString()
+ {
+ decorator.decorate(decorated);
+ return decorator.toString();
+ }
+ }
+}
\ No newline at end of file
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPBody.java (from rev 530, components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPBody.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPBody.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPBody.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -0,0 +1,57 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.gatein.wsrp.test.handler;
+
+import org.jboss.util.xml.DOMUtils;
+import org.w3c.dom.Element;
+
+import javax.xml.soap.SOAPBody;
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MockSOAPBody implements InvocationHandler
+{
+ Element body;
+
+ public MockSOAPBody(Element body)
+ {
+ this.body = body;
+ }
+
+ public static SOAPBody newInstance(String body) throws IOException
+ {
+ return (SOAPBody)Proxy.newProxyInstance(MockSOAPBody.class.getClassLoader(), new Class[]{SOAPBody.class},
+ new MockSOAPBody(DOMUtils.parse(body)));
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return method.invoke(body, args);
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPBody.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessage.java (from rev 530, components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessage.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessage.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessage.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -0,0 +1,158 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.gatein.wsrp.test.handler;
+
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessage">Chris
+ * Laprun</a>
+ * @version $Revision: 12277 $
+ * @since 2.4
+ */
+public class MockSOAPMessage extends SOAPMessage
+{
+ MimeHeaders headers;
+ String messageBody;
+
+ public MockSOAPMessage()
+ {
+ headers = new MimeHeaders();
+ }
+
+ public MockSOAPMessage(MimeHeaders headers)
+ {
+ this.headers = headers;
+ }
+
+ public void setMessageBody(String messageBody)
+ {
+ this.messageBody = messageBody;
+ }
+
+ @Override
+ public SOAPBody getSOAPBody() throws SOAPException
+ {
+ try
+ {
+ return MockSOAPBody.newInstance(messageBody);
+ }
+ catch (IOException e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ return headers;
+ }
+
+ public void setMimeHeaders(MimeHeaders mimeHeaders)
+ {
+ this.headers = mimeHeaders;
+ }
+
+ public void addAttachmentPart(AttachmentPart attachmentPart)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public AttachmentPart createAttachmentPart()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getContentDescription()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setContentDescription(String string)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPPart getSOAPPart()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAllAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int countAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttachments()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * For JDK 1.6
+ */
+ public AttachmentPart getAttachment(SOAPElement element)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttachments(MimeHeaders mimeHeaders)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void saveChanges() throws SOAPException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean saveRequired()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void writeTo(OutputStream outputStream) throws SOAPException, IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAttachments(MimeHeaders mimeHeaders)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessage.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessageContext.java (from rev 530, components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/handler/MockSOAPMessageContext.java)
===================================================================
--- components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessageContext.java (rev 0)
+++ components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessageContext.java 2009-11-10 18:25:26 UTC (rev 552)
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * 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.gatein.wsrp.test.handler;
+
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com?subject=org.gatein.wsrp.wsrp.handler.MockSOAPMessageContext">Chris
+ * Laprun</a>
+ * @version $Revision: 8784 $
+ * @since 2.4
+ */
+public class MockSOAPMessageContext implements InvocationHandler
+{
+ MockSOAPMessage message;
+
+
+ public MockSOAPMessageContext(MockSOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public MockSOAPMessage getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(MockSOAPMessage message)
+ {
+ this.message = message;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+
+ if ("getMessage".equals(methodName))
+ {
+ return getMessage();
+ }
+ else if ("getProperty".equals(methodName))
+ {
+ return "http://jboss.com"; // should only be called to get the endpoint address
+ }
+ else if ("toString".equals(methodName))
+ {
+ return this.toString();
+ }
+
+ throw new UnsupportedOperationException("MockSOAPMessageContext does not support " + methodName + " method");
+ }
+
+ public static SOAPMessageContext createMessageContext(MockSOAPMessage message, ClassLoader classLoader)
+ {
+ return (SOAPMessageContext)Proxy.newProxyInstance(classLoader, new Class[]{SOAPMessageContext.class},
+ new MockSOAPMessageContext(message));
+ }
+}
Property changes on: components/wsrp/trunk/test/src/main/java/org/gatein/wsrp/test/handler/MockSOAPMessageContext.java
___________________________________________________________________
Name: svn:executable
+ *
15 years, 2 months
gatein SVN: r551 - in components/pc/trunk: portlet/src/main/java/org/gatein/pc/portlet/impl/spi and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-10 10:45:52 -0500 (Tue, 10 Nov 2009)
New Revision: 551
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java
components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr168/api/portalcontext/PortalInfoTestCase.java
Log:
- GTNPC-12:
+ Used correct PortalContext.VERSION.
+ Added documentation and PortalContext.PORTLET_SPEC_FORMAT to properly format version String to conform to spec.
+ Updated PortalInfoTestCase to be more precise.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-10 14:59:32 UTC (rev 550)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-10 15:45:52 UTC (rev 551)
@@ -36,10 +36,10 @@
*/
public interface PortalContext
{
- public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 0, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Community");
+ public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 0, new Version.Qualifier(Version.Qualifier.Prefix.CR, Version.Qualifier.Suffix.SUFFIX_1), "Community");
/**
- * Return info about the portal.
+ * Return info about the portal. Must conform to javax.portlet.PortalContext.getPortalInfo().
*
* @return portal infos
*/
@@ -65,4 +65,18 @@
* @return the properties
*/
Map<String, String> getProperties();
+
+ Version.Format PORTLET_SPEC_FORMAT = new Version.Format()
+ {
+ public String toString(Version version)
+ {
+ StringBuffer buffer = new StringBuffer(version.getName());
+ buffer.append("/")
+ .append(version.getMajor()).append('.')
+ .append(version.getMinor()).append('.')
+ .append(version.getPatch()).append('-')
+ .append(version.getQualifier());
+ return buffer.toString();
+ }
+ };
}
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java 2009-11-10 14:59:32 UTC (rev 550)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java 2009-11-10 15:45:52 UTC (rev 551)
@@ -87,7 +87,7 @@
public String getInfo()
{
- return VERSION.toString();
+ return PortalContext.PORTLET_SPEC_FORMAT.toString(VERSION);
}
public Set<WindowState> getWindowStates()
Modified: components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr168/api/portalcontext/PortalInfoTestCase.java
===================================================================
--- components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr168/api/portalcontext/PortalInfoTestCase.java 2009-11-10 14:59:32 UTC (rev 550)
+++ components/pc/trunk/test/src/test/java/org/gatein/pc/test/portlet/jsr168/api/portalcontext/PortalInfoTestCase.java 2009-11-10 15:45:52 UTC (rev 551)
@@ -22,20 +22,22 @@
******************************************************************************/
package org.gatein.pc.test.portlet.jsr168.api.portalcontext;
+import org.gatein.pc.api.spi.PortalContext;
+import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.unit.Assertion;
import org.gatein.pc.test.unit.PortletTestCase;
import org.gatein.pc.test.unit.PortletTestContext;
import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
-import org.gatein.pc.test.portlet.framework.UTP1;
import org.gatein.pc.test.unit.annotations.TestCase;
-import org.gatein.pc.test.unit.Assertion;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
-import static org.jboss.unit.api.Assert.assertTrue;
import javax.portlet.Portlet;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import static org.jboss.unit.api.Assert.assertTrue;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -52,8 +54,14 @@
String info = request.getPortalContext().getPortalInfo();
assertTrue(info.length() > 0);
- assertTrue(info.startsWith("JBossPortal"));
+ String[] components = info.split("/");
+ assertTrue(components.length == 2);
+ assertTrue(PortalContext.VERSION.getName().equals(components[0]));
+ String version = PortalContext.VERSION.getMajor() + "." + PortalContext.VERSION.getMinor() + "."
+ + PortalContext.VERSION.getPatch() + "-" + PortalContext.VERSION.getQualifier();
+ assertTrue(version.equals(components[1]));
+
return new EndTestResponse();
}
});
15 years, 2 months
gatein SVN: r550 - in components/pc/trunk: portlet/src/main/java/org/gatein/pc/portlet/impl/spi and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-10 09:59:32 -0500 (Tue, 10 Nov 2009)
New Revision: 550
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java
Log:
- GTNPC-12: Fixed PortalContext.VERSION, AbstractPortalContext.getInfo now returns VERSION.toString.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-10 13:22:35 UTC (rev 549)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-10 14:59:32 UTC (rev 550)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.gatein.pc.api.spi;
+import org.gatein.common.util.Version;
import org.gatein.pc.api.WindowState;
-import org.gatein.common.util.Version;
import java.util.Map;
import java.util.Set;
@@ -36,7 +36,7 @@
*/
public interface PortalContext
{
- public static final Version VERSION = new Version("JBoss Portlet Container", 2, 0, 8, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Community");
+ public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 0, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Community");
/**
* Return info about the portal.
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java 2009-11-10 13:22:35 UTC (rev 549)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/spi/AbstractPortalContext.java 2009-11-10 14:59:32 UTC (rev 550)
@@ -22,14 +22,14 @@
******************************************************************************/
package org.gatein.pc.portlet.impl.spi;
+import org.gatein.common.util.Tools;
+import org.gatein.pc.api.Mode;
import org.gatein.pc.api.WindowState;
-import org.gatein.pc.api.Mode;
import org.gatein.pc.api.spi.PortalContext;
-import org.gatein.common.util.Tools;
+import java.util.Collections;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -87,7 +87,7 @@
public String getInfo()
{
- return "JBossPortal/1.0";
+ return VERSION.toString();
}
public Set<WindowState> getWindowStates()
15 years, 2 months