You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by jl...@caramail.com on 2002/11/06 20:42:12 UTC

PortletConfigState.setInstanceParameter

Hi,
I try to save parameter with
PortletConfigState.setInstanceParameter like
DatabasePortletBrowser.
But I don't see in psml file the <parameter name="idChannel"
value="select USER_ID,LOGIN_NAME from TURBINE_USER order by
USER_ID"/> like DatabasePortletBrowser for paramter sql and
I can't get this parameter with
PortletConfigState.getInstanceParameter

this is the code :


...
public class CopyAndPasteAction extends VelocityPortletAction {

 public final static String ID_CHANNEL = "idChannel";
 
 /**
 * @see
org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction#buildNormalContext(VelocityPortlet,
Context, RunData)
 */
 protected void buildNormalContext(
 VelocityPortlet portlet,
 Context context,
 RunData rundata)
 throws Exception {
// String idChannel = (String)
rundata.getUser().getTemp(ID_CHANNEL);
 String idChannel =
PortletConfigState.getInstanceParameter(portlet, rundata,
ID_CHANNEL);
 String result = "pas id channel";
 
 if(idChannel != null)
 	result = "par Perm " + idChannel;

 else {
 	idChannel =
rundata.getParameters().getString(ID_CHANNEL);
 	if (idChannel != null)
		 result = "par Parm " + idChannel;
 
 }
 context.put(ID_CHANNEL, result);
 setTemplate(rundata, "CAP-Normal");
 }
 
 /**
 * @see
org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction#buildConfigureContext(VelocityPortlet,
Context, RunData)
 */
 protected void buildConfigureContext(
 VelocityPortlet portlet,
 Context context,
 RunData rundata)
 throws Exception {
 setTemplate(rundata, "CAP-Customize"); 
 }
 
 
 public void doUpdateCustomize (RunData data, Context
context) {
 	String idChanel =
data.getParameters().getString(ID_CHANNEL);
 	VelocityPortlet portlet =
(VelocityPortlet)context.get("portlet");
 	if(idChanel != null) 
// 		data.getUser().setTemp(ID_CHANNEL, idChanel); 
 		PortletConfigState.setInstanceParameter(portlet, data,
ID_CHANNEL, idChanel); 		
 	
 	
 	try {
 buildNormalContext(portlet, context, data);
 }
 catch (Exception e) {
			// log the error msg
 Log.error(e);

 data.setMessage("Error in Jetspeed Stock Quotes:
" + e.toString());
 
data.setStackTrace(org.apache.turbine.util.StringUtils.stackTrace(e),
e);
 
data.setScreenTemplate(JetspeedResources.getString("template.error","Error"));
 }
 	
 }
}


thank you

    . .       Jérôme LAFORGE
    /v\       e-mail :  jlaforge@caramail.com
   // \\      Linux is powerfull
  /(   )\     
   ^`~'^     


_________________________________________________________ 
Gagne une PS2 ! Envoie un SMS avec le code PS au 61166
(0,35€ Hors coût du SMS)