You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by mo...@apache.org on 2003/06/28 20:15:45 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets NewRSSPortlet.java
morciuch 2003/06/28 11:15:45
Modified: src/java/org/apache/jetspeed/modules/actions/portlets
CustomizeAction.java
src/java/org/apache/jetspeed/portal/portlets
NewRSSPortlet.java
Log:
The portlet customizer now properly uses parameter values from psml (see Bugzilla bug# 20075)
Revision Changes Path
1.22 +42 -14 jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeAction.java
Index: CustomizeAction.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeAction.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- CustomizeAction.java 11 Jun 2003 22:09:31 -0000 1.21
+++ CustomizeAction.java 28 Jun 2003 18:15:45 -0000 1.22
@@ -72,6 +72,7 @@
import org.apache.jetspeed.om.SecurityReference;
import org.apache.jetspeed.om.registry.PortletEntry;
import org.apache.jetspeed.om.registry.Parameter;
+import org.apache.jetspeed.om.registry.base.BaseParameter;
import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.services.PortalToolkit;
@@ -79,6 +80,9 @@
import org.apache.jetspeed.portal.PortletInstance;
import org.apache.jetspeed.util.MetaData;
import org.apache.jetspeed.services.statemanager.SessionState;
+import org.apache.jetspeed.portal.portlets.AbstractInstancePortlet;
+import org.apache.jetspeed.services.portletcache.PortletCache;
+import org.apache.jetspeed.services.PsmlManager;
// Turbine stuff
import org.apache.turbine.util.Log;
@@ -134,6 +138,9 @@
context.put("action", "portlets.CustomizeAction");
+ PortletInstance instance = PersistenceManager.getInstance(p, rundata);
+ context.put("portlet_instance", PersistenceManager.getInstance(p, rundata));
+
if (p==null) return;
// retrieve the portlet parameters
@@ -142,6 +149,7 @@
Vector params = new Vector();
Iterator i = entry.getParameterNames();
+ //System.out.println("==========================================");
while(i.hasNext())
{
String name = (String)i.next();
@@ -153,7 +161,28 @@
// check the user role
if (JetspeedSecurity.checkPermission((JetspeedUser)rundata.getUser(), new PortalResource( entry, param), JetspeedSecurity.PERMISSION_CUSTOMIZE))
{
- params.add(entry.getParameter(name));
+ // Implementation of clone() is missing so we have do it "by hand"
+ Parameter clone = new BaseParameter();
+ clone.setName(param.getName());
+ clone.setTitle(param.getTitle());
+ clone.setDescription(param.getDescription());
+ clone.setType(param.getType());
+ if (instance.getAttribute(name, null) != null)
+ {
+ clone.setValue(instance.getAttribute(name));
+ //System.out.println("Adding value from instance [" + name + "] = [" + clone.getValue() + "]");
+ }
+ else if (p.getPortletConfig().getInitParameter(name) != null)
+ {
+ clone.setValue(p.getPortletConfig().getInitParameter(name));
+ //System.out.println("Adding value from init [" + name + "] = [" + clone.getValue() + "]");
+ }
+ else
+ {
+ clone.setValue(param.getValue());
+ //System.out.println("Adding value from registry [" + name + "] = [" + clone.getValue() + "]");
+ }
+ params.add(clone);
}
}
}
@@ -411,6 +440,7 @@
Iterator i = params.iterator();
+ //System.out.println("==========================================");
while(i.hasNext())
{
Parameter param = (Parameter)i.next();
@@ -431,7 +461,7 @@
{
instance.setAttribute(name, newValue);
psmlValue = newValue;
- //System.out.println("setting attribute for [" + name + "]");
+ //System.out.println("setting attribute for [" + name + "] to [" + newValue + "]");
}
madePsChange = true;
}
@@ -450,23 +480,21 @@
{
try
{
- ((JetspeedRunData) rundata).getCustomizedProfile().store();
+ JetspeedRunData jdata = (JetspeedRunData) rundata;
+ profile.store();
+ //FIXME: this hack is due to the corrupted lifecycle of the portlet in the
+ //current API when caching is activated
+ p.init();
+ org.apache.jetspeed.util.PortletSessionState.setPortletConfigChanged(p, rundata);
+ }
+ catch (PortletException e)
+ {
+ Log.error("Customizer failed to reinitialize the portlet "+p.getName(), e);
}
catch (Exception e)
{
Log.error("Unable to save profile ",e);
}
- }
- //FIXME: this hack is due to the corrupted lifecycle of the portlet in the
- //current API when caching is activated
- try
- {
- org.apache.jetspeed.util.PortletSessionState.setPortletConfigChanged(p, rundata);
- p.init();
- }
- catch (PortletException e)
- {
- Log.error("Customizer failed to reinitialize the portlet "+p.getName(), e);
}
// we're done, make sure clean up the
1.19 +14 -2 jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java
Index: NewRSSPortlet.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- NewRSSPortlet.java 7 May 2003 15:16:50 -0000 1.18
+++ NewRSSPortlet.java 28 Jun 2003 18:15:45 -0000 1.19
@@ -221,7 +221,19 @@
@param data the RunData object for the request
@return the content to be displayed to the user-agent
*/
- public ConcreteElement getContent( RunData data ) {
+ public ConcreteElement getContent( RunData data )
+ {
+ if (org.apache.jetspeed.util.PortletSessionState.getPortletConfigChanged(this, data))
+ {
+ try
+ {
+ init();
+ }
+ catch (PortletException pe)
+ {
+ Log.error(pe);
+ }
+ }
CapabilityMap map = ((JetspeedRunData)data).getCapability();
String type = map.getPreferredType().toString();
ConcreteElement content = new JetspeedClearElement(INVALID_TYPE);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org