gatein SVN: r4331 - components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-09-23 06:01:31 -0400 (Thu, 23 Sep 2010)
New Revision: 4331
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvoker.java
Log:
- Copyright update.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvoker.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvoker.java 2010-09-23 10:00:23 UTC (rev 4330)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvoker.java 2010-09-23 10:01:31 UTC (rev 4331)
@@ -1,43 +1,34 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.producer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.PortletStateType;
-import org.gatein.pc.api.StatefulPortletContext;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
import org.gatein.pc.api.state.PropertyMap;
@@ -47,8 +38,12 @@
import org.gatein.registration.RegistrationManager;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.handlers.processors.WSRPInstanceContext;
-import org.oasis.wsrp.v2.InvalidHandle;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
* @version $Revision$
@@ -57,7 +52,7 @@
{
/** Registration Manager */
private RegistrationManager registrationManager; //todo: make sure it's multi-thread safe
-
+
public RegistrationManager getRegistrationManager()
{
return registrationManager;
@@ -67,20 +62,20 @@
{
this.registrationManager = registrationManager;
}
-
+
public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
{
checkPortletContext(portletContext);
Portlet portlet = super.getPortlet(portletContext);
-
+
if (!portlet.getContext().getId().equals(portletContext.getId()))
{
addPortletContext(portlet.getContext());
}
-
+
return portlet;
}
-
+
public Set<Portlet> getPortlets() throws PortletInvokerException
{
/**
@@ -88,20 +83,20 @@
* return the portlets not for the ProducerPortletInvoker from its parent, which should only return
* non-cloned Portlets.
*/
-
+
Registration registration = RegistrationLocal.getRegistration();
Set<Portlet> portlets = super.getPortlets();
-
+
//We first need to let the RegistrationPolicy know that there are potentially new portlets available
//from the PortletContainer (Note: this only included actual portlets, not clones).
List<String> portletHandleList = new ArrayList<String>();
- for (Portlet portlet: portlets)
+ for (Portlet portlet : portlets)
{
String portletHandle = WSRPUtils.convertToWSRPPortletContext(portlet.getContext()).getPortletHandle();
portletHandleList.add(portletHandle);
}
this.registrationManager.getPolicy().updatePortletHandles(portletHandleList);
-
+
//Now that the RegistrationPolicy knows about the new Portlets, we need to make
//sure that we only return portlets that the current registration has access to.
Set<Portlet> acceptedPortlets = new LinkedHashSet<Portlet>();
@@ -113,18 +108,18 @@
acceptedPortlets.add(portlet);
}
}
-
+
return acceptedPortlets;
}
-
+
public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException,
- PortletInvokerException
+ PortletInvokerException
{
checkPortletContext(invocation.getTarget());
-
+
PortletInvocationResponse response = super.invoke(invocation);
-
+
if (invocation.getInstanceContext() instanceof WSRPInstanceContext)
{
WSRPInstanceContext wsrpIC = (WSRPInstanceContext)invocation.getInstanceContext();
@@ -136,80 +131,84 @@
return response;
}
-
+
public PortletContext createClone(PortletStateType stateType, PortletContext portletContext)
- throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
{
checkPortletContext(portletContext);
-
+
PortletContext clonedPortletContext = super.createClone(stateType, portletContext);
-
+
if (!portletContext.getId().equals(clonedPortletContext.getId()))
+ {
addPortletContext(clonedPortletContext);
-
+ }
+
return clonedPortletContext;
}
public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts)
- throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
{
//TODO: fix this, we shouldn't remove the pc from the registration policy unless its actually removed from the invoker cleanly
for (PortletContext portletContext : portletContexts)
{
removePortletContext(portletContext);
}
-
+
return super.destroyClones(portletContexts);
}
-
+
public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException,
- PortletInvokerException, UnsupportedOperationException
+ PortletInvokerException, UnsupportedOperationException
{
checkPortletContext(portletContext);
return super.getProperties(portletContext);
}
-
+
public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException,
- PortletInvokerException, UnsupportedOperationException
+ PortletInvokerException, UnsupportedOperationException
{
checkPortletContext(portletContext);
return super.getProperties(portletContext, keys);
}
-
+
public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
- throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
{
checkPortletContext(portletContext);
PortletContext updatedPortletContext = super.setProperties(portletContext, changes);
-
+
if (!portletContext.getId().equals(updatedPortletContext.getId()))
{
addPortletContext(updatedPortletContext);
}
-
+
return updatedPortletContext;
}
-
+
public PortletContext importPortlet(PortletStateType stateType, PortletContext originalPortletContext)
- throws PortletInvokerException, IllegalArgumentException
+ throws PortletInvokerException, IllegalArgumentException
{
//The original portletcontext is the non cloned version and should be one the PC available from the getPortlets operation
checkPortletContext(originalPortletContext);
PortletContext newPortletContext = super.importPortlet(stateType, originalPortletContext);
-
+
if (!newPortletContext.getId().equals(originalPortletContext.getId()))
+ {
addPortletContext(newPortletContext);
-
+ }
+
return newPortletContext;
}
-
+
public PortletContext exportPortlet(PortletStateType stateType, PortletContext portletContext)
- throws PortletInvokerException, IllegalArgumentException
+ throws PortletInvokerException, IllegalArgumentException
{
checkPortletContext(portletContext);
return super.exportPortlet(stateType, portletContext);
}
-
+
protected boolean checkPortletContext(PortletContext portletContext) throws PortletInvokerException
{
Registration registration = RegistrationLocal.getRegistration();
@@ -223,7 +222,7 @@
throw new NoSuchPortletException("The PortletContext " + portletContext.getId() + " does not exist or the application is lacking permission to access it.", portletContext.getId());
}
}
-
+
protected void addPortletContext(PortletContext portletContext)
{
Registration registration = RegistrationLocal.getRegistration();
@@ -231,7 +230,7 @@
this.getRegistrationManager().getPolicy().addPortletHandle(registration, portletHandle);
this.getRegistrationManager().getPersistenceManager().saveChangesTo(registration);
}
-
+
protected void removePortletContext(PortletContext portletContext)
{
Registration registration = RegistrationLocal.getRegistration();
14 years, 3 months
gatein SVN: r4330 - in components/wsrp/trunk: admin-gui/src/test/java/org and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-09-23 06:00:23 -0400 (Thu, 23 Sep 2010)
New Revision: 4330
Removed:
components/wsrp/trunk/admin-gui/src/test/java/org/jboss/
Modified:
components/wsrp/trunk/pom.xml
Log:
- Updated to use PC 2.2.0-Beta03.
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2010-09-23 09:49:18 UTC (rev 4329)
+++ components/wsrp/trunk/pom.xml 2010-09-23 10:00:23 UTC (rev 4330)
@@ -47,7 +47,7 @@
</scm>
<properties>
- <version.gatein.pc>2.2.0-Beta02-SNAPSHOT</version.gatein.pc>
+ <version.gatein.pc>2.2.0-Beta03</version.gatein.pc>
<version.gatein.common>2.0.3-GA</version.gatein.common>
<version.gatein.wci>2.0.1-GA</version.gatein.wci>
14 years, 3 months
gatein SVN: r4329 - epp/portal/branches/EPP_5_1_Branch/component/web/api/src/main/java/org/exoplatform/web/filter.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:49:18 -0400 (Thu, 23 Sep 2010)
New Revision: 4329
Added:
epp/portal/branches/EPP_5_1_Branch/component/web/api/src/main/java/org/exoplatform/web/filter/ResourceOverridingFilter.java
Log:
JBEPP-487: Have the ability to modify the Favicon without changing the portal.war
Copied: epp/portal/branches/EPP_5_1_Branch/component/web/api/src/main/java/org/exoplatform/web/filter/ResourceOverridingFilter.java (from rev 4107, portal/branches/branch-r4047/component/web/api/src/main/java/org/exoplatform/web/filter/ResourceOverridingFilter.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/api/src/main/java/org/exoplatform/web/filter/ResourceOverridingFilter.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/api/src/main/java/org/exoplatform/web/filter/ResourceOverridingFilter.java 2010-09-23 09:49:18 UTC (rev 4329)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2010 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.web.filter;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.exoplatform.container.PortalContainer;
+
+/**
+ * A filter enables resource overriding via extension mechanism.
+ *
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
+ * Sep 8, 2010
+ */
+
+public class ResourceOverridingFilter implements Filter {
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ HttpServletRequest upcastedRequest = (HttpServletRequest)request;
+
+ PortalContainer portalContainer = PortalContainer.getInstance();
+ ServletContext mergedContext = portalContainer.getPortalContext();
+
+ String path = upcastedRequest.getRequestURI();
+ String ctx = upcastedRequest.getContextPath();
+
+ if(ctx != null && ctx.length() > 0 && path.startsWith(ctx))
+ {
+ path = path.substring(ctx.length());
+ }
+
+ mergedContext.getRequestDispatcher(path).include(request, response);
+ }
+
+}
14 years, 3 months
gatein SVN: r4328 - epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:47:02 -0400 (Thu, 23 Sep 2010)
New Revision: 4328
Modified:
epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/web.xml
Log:
JBEPP-486: The GenericFilter should be called after that the request context has been properly set
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/web.xml 2010-09-23 09:45:49 UTC (rev 4327)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/web.xml 2010-09-23 09:47:02 UTC (rev 4328)
@@ -114,11 +114,6 @@
<dispatcher>ERROR</dispatcher>
</filter-mapping>
- <filter-mapping>
- <filter-name>GenericFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
<filter-mapping>
<filter-name>ResourceRequestFilter</filter-name>
<url-pattern>*.css</url-pattern>
@@ -163,6 +158,12 @@
<filter-name>RestEncodingFilter</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
+
+ <filter-mapping>
+ <filter-name>GenericFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
<!-- ================================================================== -->
<!-- LISTENER -->
14 years, 3 months
gatein SVN: r4327 - epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:45:49 -0400 (Thu, 23 Sep 2010)
New Revision: 4327
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
Log:
JBEPP-485: Indicate slash symbol when using LIKE syntax to search special characters
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2010-09-23 09:42:46 UTC (rev 4326)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2010-09-23 09:45:49 UTC (rev 4327)
@@ -314,7 +314,7 @@
"jcr:path LIKE '" + workspaceChunk + "/" + ownerTypeChunk + "/" + ownerIdChunk
+ "/mop:rootpage/mop:children/mop:pages/mop:children/%' AND " +
"(" +
- "LOWER(gtn:name) LIKE '%" + title.toLowerCase() + "%')";
+ "LOWER(gtn:name) LIKE '%" + title.toLowerCase() + "%' ESCAPE '\\')";
}
else
{
14 years, 3 months
gatein SVN: r4326 - epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:42:46 -0400 (Thu, 23 Sep 2010)
New Revision: 4326
Modified:
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
JBEPP-484: Cannot change Locale of site to language having particular country.
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-09-23 09:38:46 UTC (rev 4325)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2010-09-23 09:42:46 UTC (rev 4326)
@@ -171,8 +171,13 @@
LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
LocaleConfig localeConfig = localeConfigService.getLocaleConfig(editPortal.getLocale());
- this.<UIFormInputSet> getChildById("PortalSetting").<UIFormSelectBox> getChildById(FIELD_LOCALE).setValue(
- localeConfig.getLanguage());
+ String lang = localeConfig.getLanguage();
+ if (localeConfig.getLocale().getCountry() != null && localeConfig.getLocale().getCountry().length() > 0)
+ {
+ lang += "_" + localeConfig.getLocale().getCountry();
+ }
+
+ this.<UIFormInputSet> getChildById("PortalSetting").<UIFormSelectBox> getChildById(FIELD_LOCALE).setValue(lang);
setActions(new String[]{"Save", "Close"});
}
@@ -187,7 +192,6 @@
private void createDefaultItem() throws Exception
{
- UIPortal uiPortal = Util.getUIPortal();
LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
Collection<?> listLocaleConfig = localeConfigService.getLocalConfigs();
LocaleConfig defaultLocale = localeConfigService.getDefaultLocaleConfig();
@@ -198,28 +202,27 @@
{
LocaleConfig localeConfig = (LocaleConfig)iterator.next();
ResourceBundle localeResourceBundle = getResourceBundle(currentLocale);
-
- String key = "Locale." + localeConfig.getLocale().getLanguage();
- if (localeConfig.getLocale().getCountry() != null)
+ Locale local = localeConfig.getLocale();
+ String lang = local.getLanguage();
+ if (local.getCountry() != null && local.getCountry().length() > 0)
{
- key += "_" + localeConfig.getLocale().getCountry();
+ lang += "_" + local.getCountry();
}
String displayName = null;
try
{
+ String key = "Locale." + lang;
String translation = localeResourceBundle.getString(key);
displayName = translation;
}
catch (MissingResourceException e)
{
- displayName = capitalizeFirstLetter(localeConfig.getLocale().getDisplayName(currentLocale));;
+ displayName = capitalizeFirstLetter(local.getDisplayName(currentLocale));;
}
- SelectItemOption<String> option =
- new SelectItemOption<String>(displayName, localeConfig
- .getLanguage());
- if (defaultLanguage.equals(localeConfig.getLanguage()))
+ SelectItemOption<String> option = new SelectItemOption<String>(displayName, lang);
+ if (defaultLanguage.equals(lang))
{
option.setSelected(true);
}
14 years, 3 months
gatein SVN: r4325 - epp/portal/branches/EPP_5_1_Branch/webui/eXo/src/main/java/org/exoplatform/webui/organization.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:38:46 -0400 (Thu, 23 Sep 2010)
New Revision: 4325
Modified:
epp/portal/branches/EPP_5_1_Branch/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
Log:
JBEPP-483: When creating a new user the default language shouldn't be filled (default to Arabic)
Modified: epp/portal/branches/EPP_5_1_Branch/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-09-23 09:35:27 UTC (rev 4324)
+++ epp/portal/branches/EPP_5_1_Branch/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-09-23 09:38:46 UTC (rev 4325)
@@ -189,14 +189,12 @@
{
option.setSelected(true);
}
- if (config.getLanguage().equals("en"))
- {
- lang.add(0, option);
- continue;
- }
lang.add(option);
}
+ // Set default language for new user is empty
+ lang.add(new SelectItemOption<String>("", ""));
+
Collections.sort(lang, new LanguagesComparator());
langSelectBox.setOptions(lang);
14 years, 3 months
gatein SVN: r4324 - in epp/portal/branches/EPP_5_1_Branch: webui/portal/src/main/java/org/exoplatform/portal/application and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:35:27 -0400 (Thu, 23 Sep 2010)
New Revision: 4324
Modified:
epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
Log:
JBEPP-482: Page's title and portlet's title are not localizable
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2010-09-23 09:24:46 UTC (rev 4323)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2010-09-23 09:35:27 UTC (rev 4324)
@@ -37,14 +37,7 @@
<div class="FixHeight">
<%
if(hasPermission) {
- if(portletTitle == null || portletTitle.trim().length() < 1) {
- try {
- String portletName = uicomponent.getProducedOfferedPortlet().getInfo().getName();
- print _ctx.getRequestContext().getApplicationResourceBundle().getString("UIPortlet.description." + portletName);
- } catch(Exception e){
- print uicomponent.getDisplayName();
- }
- } else print portletTitle;
+ print uicomponent.getDisplayTitle();
} else print "<div class='ProtectedContent'>"+_ctx.appRes("UIPortlet.label.protectedContent")+"</div>";
%>
</div>
@@ -62,12 +55,8 @@
if(portalMode != uiPortalApp.CONTAINER_BLOCK_EDIT_MODE && portalMode != uiPortalApp.APP_BLOCK_EDIT_MODE) {
if(uicomponent.getShowInfoBar()) {
- String title = portletTitle;
+ String title = uicomponent.getDisplayTitle();
if(title == null || title.trim().length() < 1)
- title = uicomponent.getTitle();
- if(title == null || title.trim().length() < 1)
- title = uicomponent.getDisplayName();
- if(title == null || title.trim().length() < 1)
title = portletId;
/*Begin Window Portlet Bar*/
String visibility = "visible";
@@ -292,9 +281,7 @@
String portletIcon = uicomponent.getIcon();
if(portletIcon == null) portletIcon = "PortletIcon";
- String title = portletTitle;
- if(title == null || title.trim().length() < 1)
- title = uicomponent.getDisplayTitle();
+ String title = uicomponent.getDisplayTitle();
if(title.length() > 30) title = title.substring(0,27) + "...";
%>
<div class="PortletIcon $portletIcon"><%=hasPermission ? title : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-23 09:24:46 UTC (rev 4323)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-23 09:35:27 UTC (rev 4324)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.application;
import org.exoplatform.Constants;
+import org.exoplatform.commons.utils.ExpressionUtil;
import org.exoplatform.commons.utils.PortalPrinter;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.config.UserPortalConfigService;
@@ -224,6 +225,7 @@
if (page != null)
{
title = page.getTitle();
+ return ExpressionUtil.getExpressionValue(this.getApplicationResourceBundle(), title);
}
else
{
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-09-23 09:24:46 UTC (rev 4323)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-09-23 09:35:27 UTC (rev 4324)
@@ -160,6 +160,9 @@
private StateString navigationalState;
+ /** A field storing localized value of javax.portlet.title **/
+ private String configuredTitle;
+
public UIPortlet()
{
// That value will be overriden when it is mapped onto a data storage
@@ -386,16 +389,6 @@
supportedPublicParams_ = supportedPublicRenderParameters;
}
- public String getDisplayTitle()
- {
- String title = getTitle();
- if (title == null)
- {
- title = getDisplayName();
- }
- return title;
- }
-
public String getDisplayName()
{
if (displayName == null)
@@ -942,4 +935,37 @@
{
this.navigationalState = navigationalState;
}
+
+ protected void setConfiguredTitle(String _configuredTitle)
+ {
+ this.configuredTitle = _configuredTitle;
+ }
+
+ /**
+ * Returns the title showed on the InfoBar. The title is computed in following manner.
+ *
+ * 1. First, the method getTitle(), inherited from UIPortalComponent is called. The getTitle() returns
+ * what users set in the PortletSetting tab, the current method returns call result if it is not null.
+ *
+ * 2. configuredTitle, which is the localized value of javax.portlet.title is returned if it is not null.
+ *
+ * 3. If the method does not terminate at neither (1) nor (2), the configured display name is returned.
+ * @return
+ */
+ public String getDisplayTitle()
+ {
+ String displayedTitle = getTitle();
+ if(displayedTitle != null && displayedTitle.trim().length() > 0)
+ {
+ return displayedTitle;
+ }
+
+ if(configuredTitle != null)
+ {
+ return configuredTitle;
+ }
+
+ return getDisplayName();
+
+ }
}
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-09-23 09:24:46 UTC (rev 4323)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-09-23 09:35:27 UTC (rev 4324)
@@ -170,7 +170,6 @@
//
Text markup = null;
- String portletTitle = null;
try
{
@@ -217,8 +216,8 @@
markup = Text.create("");
break;
}
- portletTitle = fragmentResponse.getTitle();
-
+ uicomponent.setConfiguredTitle(fragmentResponse.getTitle());
+
// setup portlet properties
if (fragmentResponse.getProperties() != null)
{
@@ -337,7 +336,6 @@
WebuiBindingContext bcontext = new WebuiBindingContext(resolver, context.getWriter(), uicomponent, prcontext);
bcontext.put(UIComponent.UICOMPONENT, uicomponent);
bcontext.put("portletContent", markup);
- bcontext.put("portletTitle", portletTitle);
try
{
renderTemplate(uicomponent.getTemplate(), bcontext);
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2010-09-23 09:24:46 UTC (rev 4323)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2010-09-23 09:35:27 UTC (rev 4324)
@@ -107,6 +107,9 @@
{
try
{
+ //Needed to localize title via predefined I18n key javax.portlet.title
+ res.setTitle(getTitle(req));
+
getPortletApplication().render(req, res);
}
catch (Exception ex)
14 years, 3 months
gatein SVN: r4323 - in epp/portal/branches/EPP_5_1_Branch/component/portal/src: test/java/org/exoplatform/portal/config and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:24:46 -0400 (Thu, 23 Sep 2010)
New Revision: 4323
Modified:
epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
Log:
JBEPP-481: Always show "The page navigation for '/group' already exists" although it was deleted
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2010-09-23 09:20:39 UTC (rev 4322)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/main/java/org/exoplatform/portal/config/GroupPortalConfigListener.java 2010-09-23 09:24:46 UTC (rev 4323)
@@ -154,8 +154,11 @@
{
GroupHandler groupHandler = orgService.getGroupHandler();
Collection<String> descendantGroups = getDescendantGroups(group, groupHandler);
+ Collection<String> deletedNavigationGroups = new ArrayList<String>();
+ deletedNavigationGroups.addAll(descendantGroups);
+ deletedNavigationGroups.add(group.getId());
PageNavigation navigation = null;
- for (String childGroup : descendantGroups)
+ for (String childGroup : deletedNavigationGroups)
{
navigation = dataService.getPageNavigation(PortalConfig.GROUP_TYPE, childGroup);
if (navigation != null)
Modified: epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2010-09-23 09:20:39 UTC (rev 4322)
+++ epp/portal/branches/EPP_5_1_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestPortalConfig.java 2010-09-23 09:24:46 UTC (rev 4323)
@@ -127,6 +127,31 @@
group = groupHandler.findGroupById("/groupTest");
assertNull(group);
}
+
+ public void testGroupNavigation() throws Exception
+ {
+ GroupHandler groupHandler = org.getGroupHandler();
+ Group group = groupHandler.createGroupInstance();
+ group.setGroupName("testGroupNavigation");
+ group.setLabel("testGroupNavigation");
+
+ groupHandler.addChild(null, group, true);
+
+ PageNavigation pageNavigation = new PageNavigation();
+ pageNavigation.setOwnerId(group.getId());
+ pageNavigation.setOwnerType(PortalConfig.GROUP_TYPE);
+ storage.create(pageNavigation);
+
+ pageNavigation = storage.getPageNavigation(PortalConfig.GROUP_TYPE, group.getId());
+ assertNotNull(pageNavigation);
+
+ // Remove group
+ groupHandler.removeGroup(group, true);
+
+ // Group navigations is removed after remove group
+ pageNavigation = storage.getPageNavigation(PortalConfig.GROUP_TYPE, group.getId());
+ assertNull(pageNavigation);
+ }
public void testUserLayout() throws Exception
{
14 years, 3 months
gatein SVN: r4322 - in epp/portal/branches/EPP_5_1_Branch: examples/portlets/api and 13 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-09-23 05:20:39 -0400 (Thu, 23 Sep 2010)
New Revision: 4322
Added:
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/resources/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
Removed:
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/resources/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml
epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java
Modified:
epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/conf/portal/configuration.xml
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
Log:
JBEPP-476: GateIn PRP API Sample
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api (from rev 4242, portal/trunk/examples/portlets/api)
Deleted: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml
===================================================================
--- portal/trunk/examples/portlets/api/pom.xml 2010-09-19 11:53:07 UTC (rev 4242)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -1,39 +0,0 @@
-<?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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <!--
- the parent isn't required, you can drop it if you add a groupId
- and version
- -->
- <parent>
- <groupId>org.gatein.portal.examples.portlets</groupId>
- <artifactId>parent</artifactId>
- <version>3.2.0-Beta01-SNAPSHOT</version>
- </parent>
-
- <artifactId>gatein-api</artifactId>
- <packaging>war</packaging>
- <name>GateIn Portal Examples - GateIn API</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml (from rev 4242, portal/trunk/examples/portlets/api/pom.xml)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/pom.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,39 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!--
+ the parent isn't required, you can drop it if you add a groupId
+ and version
+ -->
+ <parent>
+ <groupId>org.gatein.portal.examples.portlets</groupId>
+ <artifactId>parent</artifactId>
+ <version>3.2.0-Beta01-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gatein-api</artifactId>
+ <packaging>war</packaging>
+ <name>GateIn Portal Examples - GateIn API</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src (from rev 4242, portal/trunk/examples/portlets/api/src)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main (from rev 4242, portal/trunk/examples/portlets/api/src/main)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java (from rev 4242, portal/trunk/examples/portlets/api/src/main/java)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org/gatein)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org/gatein/portal)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org/gatein/portal/samples)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org/gatein/portal/samples/api)
Deleted: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java
===================================================================
--- portal/trunk/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java 2010-09-19 11:53:07 UTC (rev 4242)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2010 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.gatein.portal.samples.api;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PRPPortlet extends GenericPortlet
-{
-
- @Override
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.println("Public Render Parameters<br/>");
- writer.println("<table>");
- for (Map.Entry<String, String[]> entry : req.getParameterMap().entrySet())
- {
- writer.print("<tr>");
- writer.print("<td>");
- writer.print(entry.getKey());
- writer.print("</td>");
- writer.print("<td>");
- writer.print(entry.getValue()[0]);
- writer.print("</td>");
- writer.print("</tr>");
- }
- writer.println("</table>");
-
- //
- writer.close();
- }
-}
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java (from rev 4242, portal/trunk/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/PRPPortlet.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 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.gatein.portal.samples.api;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PRPPortlet extends GenericPortlet
+{
+
+ @Override
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.println("Public Render Parameters<br/>");
+ writer.println("<table>");
+ for (Map.Entry<String, String[]> entry : req.getParameterMap().entrySet())
+ {
+ writer.print("<tr>");
+ writer.print("<td>");
+ writer.print(entry.getKey());
+ writer.print("</td>");
+ writer.print("<td>");
+ writer.print(entry.getValue()[0]);
+ writer.print("</td>");
+ writer.print("</tr>");
+ }
+ writer.println("</table>");
+
+ //
+ writer.close();
+ }
+}
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/resources (from rev 4242, portal/trunk/examples/portlets/api/src/main/resources)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp (from rev 4242, portal/trunk/examples/portlets/api/src/main/webapp)
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF (from rev 4242, portal/trunk/examples/portlets/api/src/main/webapp/WEB-INF)
Deleted: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- portal/trunk/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml 2010-09-19 11:53:07 UTC (rev 4242)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-
-<!--
-<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
- -->
-
- <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="1.0">
-
- <portlet>
- <description xml:lang="EN">Public Render Parameter API Portlet</description>
- <portlet-name>PRPAPIPortlet</portlet-name>
- <display-name xml:lang="EN">Public Render Parameter API Portlet</display-name>
- <portlet-class>org.gatein.portal.samples.api.PRPPortlet</portlet-class>
-
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
-
- <portlet-info>
- <title>PRP Portlet</title>
- <short-title>PRP Portlet</short-title>
- <keywords>Sample</keywords>
- </portlet-info>
-
- <supported-public-render-parameter>navigation_uri</supported-public-render-parameter>
- <supported-public-render-parameter>page_name</supported-public-render-parameter>
- <supported-public-render-parameter>site_type</supported-public-render-parameter>
- <supported-public-render-parameter>site_name</supported-public-render-parameter>
- <supported-public-render-parameter>window_width</supported-public-render-parameter>
- <supported-public-render-parameter>window_height</supported-public-render-parameter>
- <supported-public-render-parameter>window_show_info_bar</supported-public-render-parameter>
-
- </portlet>
-
- <public-render-parameter>
- <identifier>navigation_uri</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:navigation_uri</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>page_name</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:page_name</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>site_type</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_type</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>site_name</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_name</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_width</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_width</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_height</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_height</qname>
- </public-render-parameter>
- <public-render-parameter>
- <identifier>window_show_info_bar</identifier>
- <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_show_info_bar</qname>
- </public-render-parameter>
-
-</portlet-app>
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml (from rev 4242, portal/trunk/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/portlet.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<!--
+<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+ -->
+
+ <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="1.0">
+
+ <portlet>
+ <description xml:lang="EN">Public Render Parameter API Portlet</description>
+ <portlet-name>PRPAPIPortlet</portlet-name>
+ <display-name xml:lang="EN">Public Render Parameter API Portlet</display-name>
+ <portlet-class>org.gatein.portal.samples.api.PRPPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+
+ <portlet-info>
+ <title>PRP Portlet</title>
+ <short-title>PRP Portlet</short-title>
+ <keywords>Sample</keywords>
+ </portlet-info>
+
+ <supported-public-render-parameter>navigation_uri</supported-public-render-parameter>
+ <supported-public-render-parameter>page_name</supported-public-render-parameter>
+ <supported-public-render-parameter>site_type</supported-public-render-parameter>
+ <supported-public-render-parameter>site_name</supported-public-render-parameter>
+ <supported-public-render-parameter>window_width</supported-public-render-parameter>
+ <supported-public-render-parameter>window_height</supported-public-render-parameter>
+ <supported-public-render-parameter>window_show_info_bar</supported-public-render-parameter>
+
+ </portlet>
+
+ <public-render-parameter>
+ <identifier>navigation_uri</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:navigation_uri</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>page_name</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:page_name</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>site_type</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_type</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>site_name</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:site_name</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_width</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_width</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_height</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_height</qname>
+ </public-render-parameter>
+ <public-render-parameter>
+ <identifier>window_show_info_bar</identifier>
+ <qname xmlns:prp='http://www.gatein.org/xml/ns/prp_1_0'>prp:window_show_info_bar</qname>
+ </public-render-parameter>
+
+</portlet-app>
Deleted: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/examples/portlets/api/src/main/webapp/WEB-INF/web.xml 2010-09-19 11:53:07 UTC (rev 4242)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.5">
-
- <servlet>
- <servlet-name>GateInServlet</servlet-name>
- <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
- <load-on-startup>0</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>GateInServlet</servlet-name>
- <url-pattern>/gateinservlet</url-pattern>
- </servlet-mapping>
-
-</web-app>
Copied: epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml (from rev 4242, portal/trunk/examples/portlets/api/src/main/webapp/WEB-INF/web.xml)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/api/src/main/webapp/WEB-INF/web.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.5">
+
+ <servlet>
+ <servlet-name>GateInServlet</servlet-name>
+ <servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>GateInServlet</servlet-name>
+ <url-pattern>/gateinservlet</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Modified: epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/examples/portlets/pom.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -14,6 +14,7 @@
<name>GateIn Portal Examples - Portlets</name>
<modules>
+ <module>api</module>
<module>jsfhellouser</module>
<module>jsphellouser</module>
<module>simplesthelloworld</module>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/conf/portal/configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/conf/portal/configuration.xml 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/conf/portal/configuration.xml 2010-09-23 09:20:39 UTC (rev 4322)
@@ -43,22 +43,39 @@
<type>org.exoplatform.portal.application.state.ContextualPropertyManagerImpl</type>
<component-plugins>
<component-plugin>
- <name>NavigationalStateProviderPlugin</name>
+ <name>PublicPropertiesPlugin</name>
<set-method>addPlugin</set-method>
- <type>org.exoplatform.portal.application.state.NavigationalStateProviderPlugin</type>
+ <type>org.exoplatform.portal.application.state.PublicPropertiesPlugin</type>
<init-params>
<value-param>
<name>namespaceURI</name>
<description>Namespace URI</description>
- <value>http://www.gatein.org</value>
+ <value>http://www.gatein.org/xml/ns/prp_1_0</value>
</value-param>
<value-param>
<name>prefix</name>
<description>Prefix of QName</description>
- <value>gtn</value>
+ <value>prp</value>
</value-param>
</init-params>
</component-plugin>
+ <component-plugin>
+ <name>InternalPropertiesPlugin</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.portal.application.state.InternalPropertiesPlugin</type>
+ <init-params>
+ <value-param>
+ <name>namespaceURI</name>
+ <description>Namespace URI</description>
+ <value>http://www.gatein.org/xml/ns/internal_prp_1_0</value>
+ </value-param>
+ <value-param>
+ <name>prefix</name>
+ <description>Prefix of QName</description>
+ <value>iprp</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
</component-plugins>
</component>
</configuration>
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -23,16 +23,39 @@
import javax.xml.namespace.QName;
import org.exoplatform.container.component.BaseComponentPlugin;
+import org.exoplatform.container.xml.InitParams;
import org.exoplatform.portal.webui.application.UIPortlet;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @date
*/
-
public abstract class AbstractContextualPropertyProviderPlugin extends BaseComponentPlugin
{
- public abstract Map<QName, String[]> getProperties(UIPortlet portletWindow);
+ /** . */
+ protected final Logger log = LoggerFactory.getLogger(getClass());
+ /** . */
+ protected final String namespaceURI;
+
+ /** . */
+ protected final String prefix;
+
+ protected AbstractContextualPropertyProviderPlugin(InitParams params)
+ {
+ this.namespaceURI = params.getValueParam("namespaceURI").getValue();
+ this.prefix = params.getValueParam("prefix").getValue();
+ }
+
+ public abstract void getProperties(UIPortlet portletWindow, Map<QName, String[]> properties);
+
+ protected final void addProperty(Map<QName, String[]> map, QName qname, String value)
+ {
+ if (value != null)
+ {
+ map.put(qname, new String[]{value});
+ }
+ }
}
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -23,16 +23,19 @@
import javax.xml.namespace.QName;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.picocontainer.Startable;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @date
*/
-
-public interface ContextualPropertyManager extends Startable
+public interface ContextualPropertyManager
{
+ /**
+ * Returns a map of qualified names and string values for contextual properties of the portlet.
+ *
+ * @param portletWindow the portlet
+ * @return the contextual properties
+ */
public Map<QName, String[]> getProperties(UIPortlet portletWindow);
}
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -27,41 +27,42 @@
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.portal.webui.application.UIPortlet;
+import org.picocontainer.Startable;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
* @date
*/
-public class ContextualPropertyManagerImpl implements ContextualPropertyManager
+public class ContextualPropertyManagerImpl implements ContextualPropertyManager, Startable
{
- private List<AbstractContextualPropertyProviderPlugin> propertyProviderPlugins;
+ private ArrayList<AbstractContextualPropertyProviderPlugin> propertyProviderPlugins;
public ContextualPropertyManagerImpl() throws Exception
{
propertyProviderPlugins = new ArrayList<AbstractContextualPropertyProviderPlugin>();
}
- @Override
public Map<QName, String[]> getProperties(UIPortlet portletWindow)
{
Map<QName, String[]> whatPortletWindowSee = new HashMap<QName, String[]>();
-
- for(AbstractContextualPropertyProviderPlugin plugin : propertyProviderPlugins)
+
+ // No need to use an iterator here
+ for (int i = 0;i < propertyProviderPlugins.size();i++)
{
- whatPortletWindowSee.putAll(plugin.getProperties(portletWindow));
+ AbstractContextualPropertyProviderPlugin plugin = propertyProviderPlugins.get(i);
+ plugin.getProperties(portletWindow, whatPortletWindowSee);
}
-
+
+ //
return whatPortletWindowSee;
}
- @Override
public void start()
{
}
- @Override
public void stop()
{
}
@@ -73,5 +74,4 @@
propertyProviderPlugins.add((AbstractContextualPropertyProviderPlugin)plugin);
}
}
-
}
Copied: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java (from rev 4242, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 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.application.state;
+
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.portal.webui.application.UIPortlet;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * This plugins setup properties that are NOT publicly supported, however it is recommanded to not change anything
+ * but there are no guarantees that it won't change.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InternalPropertiesPlugin extends AbstractContextualPropertyProviderPlugin
+{
+
+ /** . */
+ private final QName storageIdQName;
+
+ /** . */
+ private final QName storageNameQName;
+
+ public InternalPropertiesPlugin(InitParams params)
+ {
+ super(params);
+
+ //
+ this.storageIdQName = new QName(namespaceURI, "storage_id", prefix);
+ this.storageNameQName = new QName(namespaceURI, "storage_name", prefix);
+ }
+
+ @Override
+ public void getProperties(UIPortlet portletWindow, Map<QName, String[]> properties)
+ {
+ addProperty(properties, storageIdQName, portletWindow.getStorageId());
+ addProperty(properties, storageNameQName, portletWindow.getStorageName());
+ }
+}
Deleted: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -1,86 +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.application.state;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-
-/**
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
- * @date
- */
-
-public class NavigationalStateProviderPlugin extends AbstractContextualPropertyProviderPlugin
-{
-
- private final String NAMESPACE_URI;
-
- private final String PREFIX;
-
- public NavigationalStateProviderPlugin(InitParams params) throws Exception
- {
- NAMESPACE_URI = params.getValueParam("namespaceURI").getValue();
- PREFIX = params.getValueParam("prefix").getValue();
- }
-
- @Override
- public Map<QName, String[]> getProperties(UIPortlet portletWindow)
- {
- Map<QName, String[]> whatThisPluginProvides = new HashMap<QName, String[]>();
-
- try
- {
- UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
- PageNode currentNode = currentSite.getSelectedNode();
-
- //Provides current node URI
- whatThisPluginProvides.put(new QName(NAMESPACE_URI, "navigation_uri", PREFIX), new String[]{currentNode.getUri()});
-
- //Provides current page name
- UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
- if(currentPage != null)
- {
- whatThisPluginProvides.put(new QName(NAMESPACE_URI, "page_name", PREFIX), new String[]{currentPage.getTitle()});
- }
-
- //Provides current site type
- whatThisPluginProvides.put(new QName(NAMESPACE_URI, "site_type", PREFIX), new String[]{currentSite.getOwnerType()});
-
- //Provides current site name
- whatThisPluginProvides.put(new QName(NAMESPACE_URI, "site_name", PREFIX), new String[]{currentSite.getOwner()});
-
- return whatThisPluginProvides;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return null;
- }
- }
-
-}
Copied: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java (from rev 4242, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -0,0 +1,108 @@
+/*
+ * 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.application.state;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.webui.application.UIPortlet;
+import org.exoplatform.portal.webui.page.UIPage;
+import org.exoplatform.portal.webui.portal.UIPortal;
+import org.exoplatform.portal.webui.util.Util;
+
+/**
+ * This plugin setup properties that are publicly supported, hence this is part of a public API
+ * and once published its contract must not change whatsoever.
+ *
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang TO</a>
+ */
+public class PublicPropertiesPlugin extends AbstractContextualPropertyProviderPlugin
+{
+
+ /** . */
+ private final QName navigationURIQName;
+
+ /** . */
+ private final QName pageNameQName;
+
+ /** . */
+ private final QName siteTypeQName;
+
+ /** . */
+ private final QName siteNameQName;
+
+ /** . */
+ private final QName windowShowInfoBarQName;
+
+ /** . */
+ private final QName windowHeight;
+
+ /** . */
+ private final QName windowWidth;
+
+ public PublicPropertiesPlugin(InitParams params) throws Exception
+ {
+ super(params);
+
+ //
+ this.navigationURIQName = new QName(namespaceURI, "navigation_uri", prefix);
+ this.pageNameQName = new QName(namespaceURI, "page_name", prefix);
+ this.siteTypeQName = new QName(namespaceURI, "site_type", prefix);
+ this.siteNameQName = new QName(namespaceURI, "site_name", prefix);
+ this.windowWidth = new QName(namespaceURI, "window_width", prefix);
+ this.windowHeight = new QName(namespaceURI, "window_height", prefix);
+ this.windowShowInfoBarQName = new QName(namespaceURI, "window_show_info_bar", prefix);
+ }
+
+ @Override
+ public void getProperties(UIPortlet portletWindow, Map<QName, String[]> properties)
+ {
+ try
+ {
+ UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
+ PageNode currentNode = currentSite.getSelectedNode();
+
+ // Navigation related properties
+ addProperty(properties, navigationURIQName, currentNode.getUri());
+
+ // Page related properties
+ UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
+ if(currentPage != null)
+ {
+ addProperty(properties, pageNameQName, currentPage.getTitle());
+ }
+
+ // Site related properties
+ addProperty(properties, siteTypeQName, currentSite.getOwnerType());
+ addProperty(properties, siteNameQName, currentSite.getOwner());
+
+ // Window related properties
+ addProperty(properties, windowShowInfoBarQName, Boolean.toString(portletWindow.getShowInfoBar()));
+ addProperty(properties, windowWidth, portletWindow.getWidth());
+ addProperty(properties, windowHeight, portletWindow.getHeight());
+ }
+ catch (Exception ex)
+ {
+ log.error("Could not obtain contextual properties for portlet " + portletWindow, ex);
+ }
+ }
+}
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-09-23 09:16:05 UTC (rev 4321)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-09-23 09:20:39 UTC (rev 4322)
@@ -154,7 +154,7 @@
private List<QName> supportedPublishingEvents_;
- private List<String> supportedPublicParams_;
+ private Map<QName, String> supportedPublicParams_;
private boolean portletInPortal_ = true;
@@ -351,12 +351,37 @@
supportedProcessingEvents_ = supportedProcessingEvents;
}
- public List<String> getSupportedPublicRenderParameters()
+ public Map<QName, String> getSupportedPublicRenderParameters()
{
+ if (supportedPublicParams_ == null)
+ {
+ if (producedOfferedPortlet == null)
+ {
+ log.info("Could not find portlet with ID : " + producerOfferedPortletContext.getId());
+ return Collections.emptyMap();
+ }
+
+ //
+ Collection<ParameterInfo> parameters = (Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
+ Map<QName, String> supportedPublicParams = Collections.emptyMap();
+ for (ParameterInfo parameter : parameters)
+ {
+ if (supportedPublicParams.isEmpty())
+ {
+ supportedPublicParams = new HashMap<QName, String>();
+ }
+ supportedPublicParams.put(parameter.getName(), parameter.getId());
+ }
+
+ //
+ this.supportedPublicParams_ = supportedPublicParams;
+ }
+
+ //
return supportedPublicParams_;
}
- public void setSupportedPublicRenderParameters(List<String> supportedPublicRenderParameters)
+ public void setSupportedPublicRenderParameters(Map<QName, String> supportedPublicRenderParameters)
{
supportedPublicParams_ = supportedPublicRenderParameters;
}
@@ -542,46 +567,35 @@
/**
* Tells, according to the info located in portlet.xml, wether this portlet supports the public render parameter
- * given as a method argument
+ * qname given as method argument. If the qname is supported, the public render parameter id is returned otherwise
+ * false is returned.
+ *
+ * @param supportedPublicParam the supported public parameter qname
+ * @return the supported public parameter id
*/
- public boolean supportsPublicParam(String supportedPublicParam)
+ public String supportsPublicParam(QName supportedPublicParam)
{
- if (supportedPublicParams_ == null)
- {
+ Map<QName, String> supportedPublicParams = getSupportedPublicRenderParameters();
+ return supportedPublicParams.get(supportedPublicParam);
+ }
- //
- if (producedOfferedPortlet == null)
- {
- log.info("Could not find portlet with ID : " + producerOfferedPortletContext.getId());
- return false;
- }
-
- //
- Collection<ParameterInfo> parameters =
- (Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
- supportedPublicParams_ = new ArrayList<String>();
- for (ParameterInfo parameter : parameters)
- {
- supportedPublicParams_.add(parameter.getId());
- }
- }
-
- //
- for (String publicParam : supportedPublicParams_)
+ /**
+ * Tells, according to the info located in portlet.xml, wether this portlet supports the public render parameter
+ * id given as a method argument.
+ *
+ * @param supportedPublicParamId the supported public parameter id
+ * @return true if the supported public parameter id is supported
+ */
+ public boolean supportsPublicParam(String supportedPublicParamId)
+ {
+ Map<QName, String> supportedPublicParams = getSupportedPublicRenderParameters();
+ boolean supported = supportedPublicParams.containsValue(supportedPublicParamId);
+ if (supported && log.isDebugEnabled())
{
- if (publicParam.equals(supportedPublicParam))
- {
- if (log.isDebugEnabled())
- {
- log.debug("The Portlet " + producerOfferedPortletContext.getId()
- + " supports the public render parameter : " + supportedPublicParam);
- }
- return true;
- }
+ log.debug("The Portlet " + producerOfferedPortletContext.getId()
+ + " supports the public render parameter : " + supportedPublicParamId);
}
-
- //
- return false;
+ return true;
}
/**
@@ -625,16 +639,19 @@
}
}
- //Handle exposed portal contextual properties
+ // Handle exposed portal contextual properties
ContextualPropertyManager propertyManager = this.getApplicationComponent(ContextualPropertyManager.class);
Map<QName, String[]> exposedPortalState = propertyManager.getProperties(this);
- for(QName qName : exposedPortalState.keySet())
+ for(QName prpQName : exposedPortalState.keySet())
{
- if(supportsPublicParam(qName.getLocalPart()))
+ String prpId = supportsPublicParam(prpQName);
+ if(prpId != null)
{
- publicParamsMap.put(qName.toString(), exposedPortalState.get(qName));
+ publicParamsMap.put(prpId, exposedPortalState.get(prpQName));
}
}
+
+ //
return publicParamsMap;
}
14 years, 3 months