⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientcardbean.java

📁 我在加拿大学习的一个比较复杂的在线银行程序.
💻 JAVA
字号:
package com.ebusiness.ebank.ejb.entitybean;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: eBusiness Inc., All right reserved</p> * @author unascribed * @version 1.0 */import java.sql.Timestamp;import javax.ejb.EntityBean;import javax.ejb.CreateException;import javax.ejb.EJBException;import javax.ejb.EntityContext;import com.ebusiness.ebank.exception.BusinessException;import com.ebusiness.ebank.exception.SystemException;import com.ebusiness.ebank.exception.ErrorMessages;import com.ebusiness.ebank.bean.ClientCardValue;abstract public class ClientCardBean implements EntityBean{    private EntityContext ctx;    private static final String INSERT = "I";    private static final String UPDATE = "U";    private static final String DELETE = "D";    //Bean attribute accessor    abstract public Long getObjectID();    abstract public void setObjectID(Long oid);    abstract public String getClientCardID();    abstract public void setClientCardID(String clientCardID);    abstract public String getPassword();    abstract public void setPassword(String password);    abstract public String getWebPassword();    abstract public void setWebPassword(String webPassword);    abstract public String getIssueNo();    abstract public void setIssueNo(String issueNo);    abstract public long getCardholderOID();    abstract public void setCardholderOID(long oid);    abstract public Timestamp getEffectiveDate();    abstract public void setEffectiveDate(Timestamp effectiveDate);    abstract public Timestamp getExpiryDate();    abstract public void setExpiryDate(Timestamp expiryDate);    abstract public String getCreateUserID();    abstract public void setCreateUserID(String createUserID);    abstract public Timestamp getCreateDate();    abstract public void setCreateDate(Timestamp createDate);    abstract public String getUpdateUserID();    abstract public void setUpdateUserID(String updateUserID);    abstract public Timestamp getUpdateDate();    abstract public void setUpdateDate(Timestamp expiryDate);    abstract public String getAction();    abstract public void setAction(String action);    // Business methods    /**     * Parse the entity bean value to ClientCardValue object     *     * @return ClientCardValue     */    public ClientCardValue getValueObject()    {        ClientCardValue value = new ClientCardValue(this.getObjectID().longValue());        value.setClientCardID(this.getClientCardID());        value.setPassword(this.getPassword());        value.setWebPassword(this.getWebPassword());        value.setIssueNo(this.getIssueNo());        value.setCardholderOID(this.getCardholderOID());        //common values        value.setEffectiveDate(this.getEffectiveDate());        value.setExpiryDate(this.getExpiryDate());        value.setCreateUserID(this.getCreateUserID());        value.setCreateDate(this.getCreateDate());        value.setUpdateUserID(this.getUpdateUserID());        value.setUpdateDate(this.getUpdateDate());        value.setAction(this.getAction());        return value;    }    public ClientCardValue ChangePW(String newPassword, boolean changeWebPW)    {        if (changeWebPW)           this.setWebPassword(newPassword);        else           this.setPassword(newPassword);        this.setUpdateUserID(this.ctx.getCallerPrincipal().getName());        return this.getValueObject();    }    /**     * @todo: Update Client card info. This is used to renew a client's card     *     * @param value :    ClientCardValue     * @return      :    updated ClientCardValue     */    public ClientCardValue update(ClientCardValue value)    {        this.setClientCardID(value.getClientCardID());        this.setIssueNo(value.getIssueNo());        this.setPassword(value.getPassword());        this.setUpdateUserID(this.ctx.getCallerPrincipal().getName());        return this.getValueObject();    }    // Framework and lifecycle methods    /**     * This method will insert a record to the ClientCard table.     * The method should be called within Cardholder Entity Bean since the ClientCard     * must have a valid cardholder     */    public Long ejbCreate(ClientCardValue value)         throws CreateException    {        this.setClientCardID(value.getClientCardID());        this.setPassword(value.getPassword());        this.setWebPassword(value.getWebPassword());        this.setIssueNo(value.getIssueNo());        this.setCardholderOID(value.getCardholderOID());        //common values        this.setEffectiveDate(value.getEffectiveDate());        this.setExpiryDate(value.getExpiryDate());        String userID = this.ctx.getCallerPrincipal().getName();        this.setCreateUserID(userID);        this.setUpdateUserID(userID);        return null; //for container managed persistence    }    public void ejbPostCreate(ClientCardValue value) throws CreateException {}    public void ejbActivate() {}    public void ejbLoad() {}    public void ejbPassivate() {}    public void ejbRemove() //this method will delete the record from database    {        this.setUpdateUserID(this.ctx.getCallerPrincipal().getName());        this.setAction(this.DELETE);    }    public void ejbStore() {}    public void setEntityContext(EntityContext ctx)    {        this.ctx = ctx;    }    public void unsetEntityContext()    {        this.ctx = null;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -