Source Code‎ > ‎src‎ > ‎in.co.sunrays.proj1‎ > ‎action‎ > ‎

ForgetPasswordAction.java

package in.co.sunrays.proj1.action;
 
import in.co.sunrays.proj1.exception.ApplicationException;
import in.co.sunrays.proj1.exception.RecordNotFoundException;
import in.co.sunrays.proj1.service.UserServiceInt;
 
import org.apache.log4j.Logger;
 
/**
 * Forget Password functionality Action. Performs operation for Forget Password
 * 
 * @author SUNRAYS Technologies
 * @version 1.0
 * @Copyright (c) SUNRAYS Technologies
 */
public class ForgetPasswordAction extends BaseAction {
 
    private static Logger log = Logger.getLogger(ForgetPasswordAction.class);
    private String login;
    private UserServiceInt service;
 
    public void setService(UserServiceInt service) {
        this.service = service;
    }
 
    public String getLogin() {
        return login;
    }
 
    public void setLogin(String login) {
        this.login = login;
    }
 
    /**
     * Performs display operations for ForgetPasswordAction
     * 
     * @return type String
     * @return INPUT
     */
    @Override
    public String input() {
        log.debug("ForgetPassworAction.input() Start");
        log.debug("ForgetPassworAction.input() End");
        return INPUT;
    }
 
    /**
     * Performs submit operations for ForgetPasswordAction
     * 
     * @return type String
     * @return SUCCESS
     */
    @Override
    public String execute() {
        log.debug("ForgetPasswordAction.execute() Start");
        try {
            if (OP_GO.equalsIgnoreCase(operation)) {
                service.forgetPassword(login);
                addActionMessage("Your password has been sent on ur Email.");
            }
        } catch (ApplicationException e) {
            log.error("Critical Issue ", e);
            return OP_ERROR;
        } catch (RecordNotFoundException e) {
            log.error("Login not exist.", e);
            addActionError("Login not exist");
            return INPUT;
        }
        log.debug("ForgetPasswordAction.execute() End " + operation);
        return operation;
    }
 
}
Comments