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 we...@apache.org on 2003/04/09 16:15:03 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util PortletConfigState.java
weaver 2003/04/09 07:15:02
Modified: src/java/org/apache/jetspeed/util PortletConfigState.java
Log:
Added the ability to set/add portlet parameters at the registry level.
Revision Changes Path
1.3 +29 -1 jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletConfigState.java
Index: PortletConfigState.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletConfigState.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PortletConfigState.java 20 Sep 2002 21:19:37 -0000 1.2
+++ PortletConfigState.java 9 Apr 2003 14:15:02 -0000 1.3
@@ -56,6 +56,9 @@
import org.apache.turbine.util.RunData;
import org.apache.jetspeed.portal.portlets.VelocityPortlet;
+import org.apache.jetspeed.services.Registry;
+import org.apache.jetspeed.om.registry.Parameter;
+import org.apache.jetspeed.om.registry.PortletEntry;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletConfig;
@@ -64,6 +67,7 @@
*
* @author <a href="mailto:david@apache.org">David Sean Taylor</a>
* @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
* @version $Id$
*/
public class PortletConfigState
@@ -174,5 +178,29 @@
String attrDefValue)
{
return getParameter((Portlet) portlet, rundata, attrName, attrDefValue);
+ }
+
+ /**
+ * Sets the registry (.xreg) value of this portlet. Use this method because
+ * PortletConfig.setInitParameter() is all but useless in this case. The portlet
+ * config availble in the Portlet is never saved back to the registry.
+ */
+ public static void setPortletConfigParameter(Portlet portlet, String name, String value)
+ {
+ PortletEntry pEntry = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());
+
+ if (pEntry != null)
+ {
+ Parameter param = pEntry.getParameter(name);
+ portlet.getPortletConfig().setInitParameter(name, value);
+ if (param != null)
+ {
+ param.setValue(value);
+ }
+ else
+ {
+ pEntry.addParameter(name, value);
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org