Refers to... .
package org.example.TSA504.pages;
import org.apache.tapestry.annotations.Component;
import org.apache.tapestry.annotations.Inject;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.corelib.components.Form;
import org.apache.tapestry.corelib.components.PasswordField;
import org.apache.tapestry.corelib.components.TextField;
import org.example.TSA504.beans.TUser;
import org.example.TSA504.services.interfaces.UserAuthenticator;
public class AddNew
{
@Persist
private String _newUserName;
private String _newFirstUserName;
private String _newLastUserName;
private String _newMI;
private String _newEmail;
private String _newPassword;
private String _confirmNewPassword;
@Component(id = "newUserName")
private TextField _newUserNameField;
@Component(id = "confirmNewPassword")
private PasswordField _confirmNewPasswordField;
@Component
private Form _regform;
@Inject
private UserAuthenticator _authenticator;
String onSuccess() {
if (!_confirmNewPassword.equals(_newPassword))
{
_regform.recordError(_confirmNewPasswordField, "Passwords don't match.");
return null;
}
if (!(_authenticator.addNewTUser(new TUser (_newUserName, _newFirstUserName,_newLastUserName,_newMI,_newEmail,_newPassword)))){
_regform.recordError(_newUserNameField, "Sorry, a error has occured upon adding the user");
return null;
}
return "Start";
}
/**
* @return the _confirmpassword
*/
public String getConfirmNewPassword() {
return _confirmNewPassword;
}
/**
* @param _confirmpassword the _confirmpassword to set
*/
public void setConfirmNewPassword(String _confirmpassword) {
this._confirmNewPassword = _confirmpassword;
}
/**
* @return the _confirmNewPasswordField
*/
public PasswordField getConfirmNewPasswordField() {
return _confirmNewPasswordField;
}
/**
* @param field the _confirmNewPasswordField to set
*/
public void setConfirmNewPasswordField(PasswordField field) {
_confirmNewPasswordField = field;
}
/**
* @return the _newPassword
*/
public String getNewPassword() {
return _newPassword;
}
/**
* @param _newPassword the _newPassword to set
*/
public void setNewPassword(String _password) {
this._newPassword = _password;
}
/**
* @return the _regform
*/
public Form getRegform() {
return _regform;
}
/**
* @param _regform the _regform to set
*/
public void setRegform(Form _regform) {
this._regform = _regform;
}
/**
* @return the _newUserName
*/
public String getNewUserName() {
return _newUserName;
}
/**
* @param name the _newUserName to set
*/
public void setNewUserName(String name) {
_newUserName = name;
}
/**
* @return the _newEmail
*/
public String get_newEmail() {
return _newEmail;
}
/**
* @return the _newFirstUserName
*/
public String get_newFirstUserName() {
return _newFirstUserName;
}
/**
* @return the _newLastUserName
*/
public String get_newLastUserName() {
return _newLastUserName;
}
/**
* @return the _newMI
*/
public String get_newMI() {
return _newMI;
}
/**
* @param email the _newEmail to set
*/
public void set_newEmail(String email) {
_newEmail = email;
}
/**
* @param firstUserName the _newFirstUserName to set
*/
public void set_newFirstUserName(String firstUserName) {
_newFirstUserName = firstUserName;
}
/**
* @param lastUserName the _newLastUserName to set
*/
public void set_newLastUserName(String lastUserName) {
_newLastUserName = lastUserName;
}
/**
* @param _newmi the _newMI to set
*/
public void set_newMI(String _newmi) {
_newMI = _newmi;
}
/**
* @return the _newUserNameField
*/
public TextField get_newUserNameField() {
return _newUserNameField;
}
/**
* @param userNameField the _newUserNameField to set
*/
public void set_newUserNameField(TextField userNameField) {
_newUserNameField = userNameField;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment