1 16 17 package org.apache.jetspeed.modules.actions; 18 19 20 import java.util.*; 22 23 import org.apache.turbine.modules.Action; 25 import org.apache.turbine.services.resources.TurbineResources; 26 27 import org.apache.turbine.util.RunData; 28 import org.apache.jetspeed.om.security.JetspeedUser; 29 import org.apache.jetspeed.services.JetspeedSecurity; 30 31 public class PrepareScreenEditAccount extends Action 32 { 33 public void doPerform( RunData rundata ) throws Exception 34 { 35 if ( ! rundata.getUser().hasLoggedIn() ) 37 { 38 rundata.setScreenTemplate( TurbineResources.getString( "services.JspService.screen.error.NotLoggedIn","Error") ); 39 return; 40 } 41 42 String username = rundata.getUser().getUserName(); 44 String firstname = null; 45 String lastname = null; 46 String email = null; 47 48 try 51 { 52 JetspeedUser user = JetspeedSecurity.getUser(rundata.getUser().getUserName()); 53 firstname = (String ) user.getFirstName(); 54 lastname = (String ) user.getLastName(); 55 email = (String ) user.getEmail(); 56 57 if ( firstname == null ) 58 firstname = ""; 59 if ( lastname == null ) 60 lastname = ""; 61 if ( email == null ) 62 email = ""; 63 64 Hashtable screenData = new Hashtable(); 65 screenData.put( "username", username ); 66 screenData.put( "firstname", firstname ); 67 screenData.put( "lastname", lastname ); 68 screenData.put( "email", email ); 69 rundata.getRequest().setAttribute( "ScreenDataEditAccount", screenData ); 70 71 return; 72 } 73 catch(Exception e) 74 { 75 rundata.setScreenTemplate( TurbineResources.getString( "services.JspService.screen.error.NotLoggedIn","Error") ); 76 return; 77 } 78 } 79 } 80 | Popular Tags |