View Javadoc

1   /*
2    * Generated by MyEclipse Struts
3    * Template path: templates/java/JavaClass.vtl
4    */
5   package hu.elte.tribus.action;
6   
7   import hu.elte.tribus.action.helper.ListWaitingRegistrationRequests;
8   import hu.elte.tribus.interfaces.UserDao;
9   import hu.elte.tribus.model.User;
10  
11  import javax.servlet.http.HttpServletRequest;
12  import javax.servlet.http.HttpServletResponse;
13  
14  import org.apache.struts.action.ActionForm;
15  import org.apache.struts.action.ActionForward;
16  import org.apache.struts.action.ActionMapping;
17  import org.springframework.web.struts.ActionSupport;
18  
19  /*** 
20   * MyEclipse Struts
21   * Creation date: 11-10-2006
22   * 
23   * XDoclet definition:
24   * @struts.action validate="true"
25   */
26  public class AcceptRegistrationRequestAction extends ActionSupport {
27  	/*
28  	 * Generated Methods
29  	 */
30  
31  	/*** 
32  	 * Method execute
33  	 * @param mapping
34  	 * @param form
35  	 * @param request
36  	 * @param response
37  	 * @return ActionForward
38  	 */
39  	public ActionForward execute(ActionMapping mapping, ActionForm form,
40  			HttpServletRequest request, HttpServletResponse response) {
41  		ListWaitingRegistrationRequests waitingRegistrationRequests = (ListWaitingRegistrationRequests) getWebApplicationContext().getBean("ListWaitingRegistrationRequests");
42  		UserDao userDao = (UserDao) getWebApplicationContext().getBean("userDao");
43  		User user = userDao.getUserById(Integer.valueOf(request.getParameter("uid")));
44  		user.setStatus(User.ENUM_STATUS_REG_ACCEPTED);
45  		userDao.saveUser(user);
46  		request.setAttribute("list", waitingRegistrationRequests.listWaitingRegistrations());
47  		request.setAttribute("user", user);
48  		return mapping.findForward("ok");
49  	}
50  }