?? signincontroller.java
字號:
/**/package org.impact.stars.control.ejb;import java.rmi.RemoteException;import javax.ejb.CreateException;import javax.ejb.EJBException;import javax.ejb.FinderException;import org.impact.stars.util.Debug;import org.impact.stars.util.EJBKeys;import org.impact.stars.util.JNDINames;//import org.impact.stars.customer.customer.ejb.Customer;import org.impact.stars.util.EJBUtil;//import org.impact.stars.customer.customer.ejb.CustomerHome;//import org.impact.stars.customer.account.model.AccountModel;import org.impact.stars.control.event.SigninEvent;import org.impact.stars.control.event.StarsEvent;import org.impact.stars.signon.ejb.SignOnLocal;import org.impact.stars.signon.ejb.SignOnLocalHome;import org.impact.stars.signon.exceptions.SignOnAppException;import org.impact.stars.signon.model.SignOnModel;import org.impact.stars.control.exceptions.GeneralFailureException;import org.impact.stars.control.exceptions.SigninFailedException;import org.impact.stars.control.exceptions.StarsEventException;public class SigninController extends StateControllerSupport { public void perform(StarsEvent event) throws StarsEventException { SigninEvent se = (SigninEvent)event; Debug.println("SigninEvent: " + se); // validate that the password matches the one in the account SignOnModel account = null; try { SignOnLocalHome home = EJBUtil.getSignOnLocalHome(); SignOnLocal cust = home.findByPrimaryKey(se.getUserName()); account = cust.getDetails(); } catch (FinderException ce) { throw new SigninFailedException("Unable to find the password details for user " + se.getUserName()); } catch (javax.naming.NamingException ne) { throw new GeneralFailureException("Irrecoverable error while trying to verify the the user while signin : " + ne); } if ((account != null) & account.getPassWord().equals(se.getPassword())) { Debug.println("Password valid for =" + se.getUserName()); machine.setAttribute(EJBKeys.USERNAME,se.getUserName()); machine.setAttribute(EJBKeys.PASSWORD,se.getPassword()); } else { Debug.println("Invalide password: for =" + se.getUserName()); throw new SigninFailedException("password is wrong"); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -