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

📄 alertsbean.java

📁 Oracle的J2EE Sample
💻 JAVA
字号:
/*
 * @author : Umesh Kulkarni
 * @version 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 *
 * Name of the File : AlertsBean.java
 *
 * Creation / Modification History
 *    Umesh           26-Apr-2002        Created
 *
 */
package oracle.otnsamples.ibfbs.usermanagement.ejb;

// Import Required Packages
import javax.ejb.EntityContext;

/**
 * This Class acts as Bean Implementation for AlertsBean which is a local
 * EJB Object. UserAccount is an Entity Object. Every User Account can have
 * multiple Alerts and this  1:N relationship between User Account Entity Bean
 * and Alerts Bean is managed by the EJB Container.
 *
 * This new feature called CMR (Container Managed RelationShips) is a new 
 * feature added in EJB 2.0 Specification.
 *
 * Note that A) This class is defined as abstract as Container actually 
 * implements most of the logic for managing relationships (CMRs). 
 * This feature is added in EJB 2.0 Specification
 * B) This Class also do not declare the instance variables such as 
 * AccountNumber, Symbol etc. In earlier approach EJB 1.1, the entity bean 
 * used to declare the instance variables mapping to variables in the 
 * Entity object. This was removed in EJB 2.0 Specification.

 *

 * @version 1.0

 * @since   1.0
 */
public abstract class AlertsBean implements javax.ejb.EntityBean {

  /**
   * Method which is called by the Container when the client invoked create()
   * method on the home interface.
   *
   * @param id            Primary Key field of the Alert Bean
   * @param accountNumber Account Number associated with the Alert
   * @param symbol        Symbol for which the alert is set
   * @param minLimit      Value of Minimum Limit below which 
   *                         alert should be activated.
   * @param maxLimit      Value of Maximum Limit above which 
   *                          alert should be activated.
   * @return Value of primary key. Here it returns null.

   * @since 1.0
   */
  public Integer ejbCreate(Integer id, Integer accountNumber, String symbol,
                           Integer minLimit, Integer maxLimit) {

    setId(id);
    setAccountNumber(accountNumber);
    setSymbol(symbol);
    setMinLimit(minLimit);
    setMaxLimit(maxLimit);

    return null;
  }


  /**
   * Declare Abstract Methods for persistent fields. Note that the persistent
   * fields are id,accountNumber, Symbol, minLimit, maxLimit
   * These methods are supplied by the EJB Container itself. In EJB 1.1 spec,
   * it was the responsibility of the bean itself to manage these fields.
   */

  /**
   * Method to get the value of Id field. This method definition is provided by
   * the container.
   *
   * @return Desired ID Value
   * @since 1.0

   */
  public abstract Integer getId();

  /**
   * Method to set the value of Id field. This method definition is provided by
   * the container.
   * @param id Id value of the Alert
   * @since 1.0

   */
  public abstract void setId(Integer id);

  /**
   * Method to get the value of accountNumber field. This method definition 
   * is provided by the container.
   *
   * @return Desired acountNumber Value
   * @since 1.0

   */
  public abstract Integer getAccountNumber();

  /**
   * Method to set the value of Account Number field. The method definition 
   * is provided by the container.
   *
   * @param accountNumber  New Value of accountNumber which needs to be set.
   * @since 1.0

   */
  public abstract void setAccountNumber(Integer accountNumber);

  /**
   * Method to get the value of Symbol field. The method definition 
   * is provided by the container.
   *
   * @return Desired Symbol Value
   * @since 1.0

   */
  public abstract String getSymbol();

  /**
   * Method to set the value of Symbol field. The method definition 
   * is provided by the container.
   *
   * @param symbol  New Value of symbol which needs to be set.
   * @since 1.0

   */
  public abstract void setSymbol(String symbol);

  /**
   * Method to get the value of Min Limit field. The method definition 
   * is provided by the container.
   *
   * @return Desired Min Limit Value
   * @since 1.0

   */
  public abstract Integer getMinLimit();

  /**
   * Method to set the value of Min Limit field. The method definition 
   * is provided by the container.
   *
   * @param minLimit  New Value of minimum Limit which needs to be set.
   * @since 1.0

   */
  public abstract void setMinLimit(Integer minLimit);

  /**
   * Method to get the value of Max Limit field. The method definition 
   * is provided by the container.
   *
   * @return Desired Max Limit Value
   * @since 1.0

   */
  public abstract Integer getMaxLimit();

  /**
   * Method to set the value of Max Limit field. The method definition 
   * is provided by the container.
   *
   * @param maxLimit  New Value of maximum Limit which needs to be set.
   * @since 1.0

   */
  public abstract void setMaxLimit(Integer maxLimit);

  /**
   * standard call back methods
   */
  public void setEntityContext(EntityContext ec) {}

  public void unsetEntityContext() {}

  public void ejbLoad() {}

  public void ejbStore() {}

  public void ejbActivate() {}

  public void ejbPassivate() {}

  public void ejbRemove() {}


  /**

   * Method which is called by the Container after invoking of ejbCreate().

   * This method has the same signature as ejbCreate() method.

   *

   * @param id            Primary Key field of the Alert Bean

   * @param accountNumber Account Number associated with the Alert

   * @param symbol        Symbol for which the alert is set

   * @param minLimit      Value of Minimum Limit below which alert 

   *                         should be activated.

   * @param maxLimit      Value of Maximum Limit above which alert 

   *                         should be activated.

   * @since 1.0

   */

  public void ejbPostCreate(Integer id, Integer accountNumber, String symbol,

                            Integer minLimit, Integer maxLimit) {}



}

⌨️ 快捷键说明

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