1 2 package org.roller.presentation.website.formbeans; 3 4 import org.roller.RollerException; 5 import org.roller.pojos.UserData; 6 import org.roller.presentation.forms.UserForm; 7 import org.roller.util.DateUtil; 8 9 import java.sql.Timestamp ; 10 import java.util.Date ; 11 import java.util.Locale ; 12 13 17 public class UserFormEx extends UserForm 18 { 19 private String mTheme = null; 20 private String mLocale = null; 21 private String mTimezone = null; 22 private String mPasswordText = null; 23 private String mPasswordConfirm = null; 24 private boolean adminCreated = false; 25 26 public UserFormEx() 27 { 28 super(); 29 } 30 31 public UserFormEx( UserData userData, java.util.Locale locale ) throws RollerException 32 { 33 super(userData, locale); 34 } 35 36 public String getTheme() 37 { 38 return mTheme; 39 } 40 41 public void setTheme( String theme ) 42 { 43 mTheme = theme; 44 } 45 public String getLocale() 46 { 47 return mLocale; 48 } 49 50 public void setLocale(String locale) 51 { 52 mLocale = locale; 53 } 54 55 public String getTimezone() 56 { 57 return mTimezone; 58 } 59 60 public void setTimezone(String timezone) 61 { 62 mTimezone = timezone; 63 } 64 65 69 public String getPasswordText() 70 { 71 return mPasswordText; 72 } 73 74 78 public void setPasswordText(String passwordText) 79 { 80 mPasswordText = passwordText; 81 } 82 83 86 public String getPasswordConfirm() 87 { 88 return mPasswordConfirm; 89 } 90 91 94 public void setPasswordConfirm(String passwordConfirm) 95 { 96 mPasswordConfirm = passwordConfirm; 97 } 98 99 102 public void setDateCreatedAsString(String value) 103 { 104 if ( value == null || value.trim().length() == 0 ) 105 { 106 this.setDateCreated(null); 107 } 108 else 109 { 110 try 111 { 112 Date pubDate = DateUtil.parse( 113 value, DateUtil.friendlyTimestampFormat()); 114 this.setDateCreated(new Timestamp (pubDate.getTime())); 115 } 116 catch (java.text.ParseException pe) 117 { 118 Date pubDate = DateUtil.parseFromFormats(value); 120 this.setDateCreated( new Timestamp (pubDate.getTime()) ); 121 } 122 } 123 } 124 125 128 public String getDateCreatedAsString() 129 { 130 return DateUtil.friendlyTimestamp(this.getDateCreated()); 131 } 132 133 134 139 public void copyTo(UserData dataHolder, Locale locale) 140 throws RollerException 141 { 142 String password = dataHolder.getPassword(); 143 Date dateCreated = dataHolder.getDateCreated(); 144 145 super.copyTo(dataHolder, locale); 146 147 dataHolder.setPassword(password); 148 dataHolder.setDateCreated(dateCreated); 149 } 150 151 152 public void setAdminCreated(boolean b) { 153 adminCreated = b; 154 } 155 156 public boolean getAdminCreated() { 157 return adminCreated; 158 } 159 } 160 161 | Popular Tags |