Author: woonsan
Date: Wed Mar 24 18:30:17 2010
New Revision: 927141
URL: http://svn.apache.org/viewvc?rev=927141&view=rev
Log:
JS2-1120: Allow override portlet icons path by portlet application context
relative path.
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/beans/PortletDefinitionBean.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/beans/PortletDefinitionBean.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/beans/PortletDefinitionBean.java?rev=927141&r1=927140&r2=927141&view=diff
==============================================================================
---
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/beans/PortletDefinitionBean.java
(original)
+++
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/beans/PortletDefinitionBean.java
Wed Mar 24 18:30:17 2010
@@ -25,11 +25,15 @@ import javax.xml.bind.annotation.XmlElem
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
import org.apache.jetspeed.om.portlet.Description;
import org.apache.jetspeed.om.portlet.DisplayName;
+import org.apache.jetspeed.om.portlet.GenericMetadata;
import org.apache.jetspeed.om.portlet.InitParam;
import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+import org.apache.jetspeed.om.portlet.PortletApplication;
import org.apache.jetspeed.om.portlet.PortletDefinition;
import org.apache.jetspeed.om.portlet.Supports;
@@ -44,9 +48,12 @@ public class PortletDefinitionBean imple
private static final long serialVersionUID = 1L;
private String applicationName;
+ private String applicationContextPath;
private String portletName;
private String uniqueName;
private String portletIcon;
+ private String portletIconHolder;
+ private String portletIconBasePath;
private PortletInfoBean portletInfoBean;
private Collection<DisplayNameBean> displayNameBeans;
private Collection<DescriptionBean> descriptionBeans;
@@ -63,7 +70,9 @@ public class PortletDefinitionBean imple
public PortletDefinitionBean(final PortletDefinition portletDefinition)
{
- applicationName = portletDefinition.getApplication().getName();
+ PortletApplication portletApplication =
portletDefinition.getApplication();
+ applicationName = portletApplication.getName();
+ applicationContextPath = portletApplication.getContextPath();
portletName = portletDefinition.getPortletName();
uniqueName = portletDefinition.getUniqueName();
portletInfoBean = new
PortletInfoBean(portletDefinition.getPortletInfo());
@@ -115,6 +124,26 @@ public class PortletDefinitionBean imple
portletIcon = initParam.getParamValue();
}
}
+
+ if (portletIcon != null)
+ {
+ GenericMetadata appMetadata = portletApplication.getMetadata();
+
+ Collection<LocalizedField> fields =
appMetadata.getFields(PortalReservedParameters.PORTLET_ICON_HOLDER);
+
+ if (fields != null && !fields.isEmpty())
+ {
+ portletIconHolder = fields.iterator().next().getValue();
+ }
+
+ fields =
appMetadata.getFields(PortalReservedParameters.PORTLET_ICON_BASE_PATH);
+
+ if (fields != null && !fields.isEmpty())
+ {
+ portletIconBasePath = fields.iterator().next().getValue();
+ }
+ }
+
initParamBeans = initParamBeanList;
}
@@ -128,6 +157,16 @@ public class PortletDefinitionBean imple
this.applicationName = applicationName;
}
+ public String getApplicationContextPath()
+ {
+ return applicationContextPath;
+ }
+
+ public void setApplicationContextPath(String applicationContextPath)
+ {
+ this.applicationContextPath = applicationContextPath;
+ }
+
public String getPortletName()
{
return portletName;
@@ -148,6 +187,26 @@ public class PortletDefinitionBean imple
this.portletIcon = portletIcon;
}
+ public String getPortletIconHolder()
+ {
+ return portletIconHolder;
+ }
+
+ public void setPortletIconHolder(String portletIconHolder)
+ {
+ this.portletIconHolder = portletIconHolder;
+ }
+
+ public String getPortletIconBasePath()
+ {
+ return portletIconBasePath;
+ }
+
+ public void setPortletIconBasePath(String portletIconBasePath)
+ {
+ this.portletIconBasePath = portletIconBasePath;
+ }
+
public String getUniqueName()
{
return uniqueName;
Modified:
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=927141&r1=927140&r2=927141&view=diff
==============================================================================
---
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
Wed Mar 24 18:30:17 2010
@@ -116,6 +116,20 @@ public interface PortalReservedParameter
public static final String PORTLET_EXTENDED_DESCRIPTOR_OUT_OF_SERVICE =
"service.out";
/**
+ * A portlet application can have a specific setting for the portlet icon
holder, either 'portlet' or 'portal'.
+ * If it is set to 'portlet', then the portlet icon images are located in
the portlet application resources.
+ * If it is set to 'portal', then the portlet icon images are located in
the portal application resources.
+ * The portlet icon holder application type, either 'portlet' or 'portal'.
+ */
+ public static final String PORTLET_ICON_HOLDER = "portlet.icon.holder";
+
+ /**
+ * A portlet can have a specific setting for the context relative base
path of portlet icon image resources.
+ * The portlet icon resource context relative base path.
+ */
+ public static final String PORTLET_ICON_BASE_PATH =
"portlet.icon.base.path";
+
+ /**
* A portlet can have a specific setting for the preview image.
* The portlet preview image url
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]