1 2 package org.roller.presentation.website.formbeans; 3 4 import java.util.Locale ; 5 6 import org.apache.struts.action.ActionMapping; 7 import org.roller.RollerException; 8 import org.roller.pojos.UserData; 9 import org.roller.presentation.forms.UserForm; 10 11 import javax.servlet.http.HttpServletRequest ; 12 13 19 public class UserAdminForm extends UserFormEx 20 { 21 private boolean mDelete = false; 22 private Boolean mUserEnabled = Boolean.FALSE; 23 private Boolean mUserAdmin = Boolean.FALSE; 24 25 public UserAdminForm() 26 { 27 super(); 28 } 29 30 public UserAdminForm(UserData userData, java.util.Locale locale ) throws RollerException 31 { 32 super(userData, locale); 33 } 34 35 39 public boolean getDelete() 40 { 41 return mDelete; 42 } 43 44 47 public void setDelete(boolean delete) 48 { 49 mDelete = delete; 50 } 51 52 public void reset(ActionMapping mapping, HttpServletRequest request) 53 { 54 super.reset(mapping, request); 55 mDelete = false; 56 } 57 58 61 public Boolean getUserEnabled() 62 { 63 return this.mUserEnabled; 64 } 65 66 69 public void setUserEnabled(Boolean enabled) 70 { 71 this.mUserEnabled = enabled; 72 } 73 74 77 public Boolean getUserAdmin() { 78 return mUserAdmin; 79 } 80 81 84 public void setUserAdmin(Boolean userAdmin) { 85 mUserAdmin = userAdmin; 86 } 87 88 89 public void copyTo(UserData user, Locale locale) 90 throws RollerException 91 { 92 super.copyTo(user, locale); 93 if (mUserAdmin.booleanValue()) 94 { 95 user.grantRole("admin"); 96 } 97 else 98 { 99 user.revokeRole("admin"); 100 } 101 } 102 103 104 public void copyFrom(UserData user, Locale locale) 105 throws RollerException 106 { 107 super.copyFrom(user, locale); 108 mUserAdmin = user.hasRole("admin") ? Boolean.TRUE : Boolean.FALSE; 109 } 110 } 111 | Popular Tags |