Context context,
RunData rundata )
{
try
{
Role role = null;
/*
* Grab the mode for the user form.
*/
String mode = rundata.getParameters().getString(SecurityConstants.PARAM_MODE);
// if we are updating or deleting - put the name in the context
//
if (mode != null && (mode.equals(SecurityConstants.PARAM_MODE_UPDATE) ||
mode.equals(SecurityConstants.PARAM_MODE_DELETE)))
{
// get the primary key and put the object in the context
String rolename = rundata.getParameters().getString(SecurityConstants.PARAM_ENTITY_ID);
role = JetspeedSecurity.getRole(rolename);
context.put(SecurityConstants.CONTEXT_ROLE, role);
}
//
// if there was an error, display the message
//
String msgid = rundata.getParameters().getString(SecurityConstants.PARAM_MSGID);
if (msgid != null)
{
int id = Integer.parseInt(msgid);
if (id < SecurityConstants.MESSAGES.length)
context.put(SecurityConstants.PARAM_MSG, SecurityConstants.MESSAGES[id]);
// get the bad entered data and put it back for convenient update
Role tempRole = (Role)rundata.getUser().getTemp(TEMP_ROLE);
if (tempRole != null)
context.put(SecurityConstants.CONTEXT_ROLE, tempRole);
}
context.put(SecurityConstants.PARAM_MODE, mode);