// we should first retrieve the portlet to customize
Portlet p = ((JetspeedRunData) rundata).getCustomized();
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
PortletEntry entry =
(PortletEntry) Registry.getEntry(Registry.PORTLET, p.getName());
// save the entry in the session
Vector params = new Vector();
Iterator i = entry.getParameterNames();
//System.out.println("==========================================");
while (i.hasNext())
{
String name = (String) i.next();
Parameter param = entry.getParameter(name);
// filter some "system" and hidden parameters
if ((!param.isHidden()) && (name.charAt(0) != '_'))
{
// check the user role
if (JetspeedSecurity
.checkPermission(
(JetspeedUser) rundata.getUser(),
new PortalResource(entry, param),
JetspeedSecurity.PERMISSION_CUSTOMIZE))
{
// 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)
{