Esempio n. 1
0
  /**
   * Business unit of work This method is used to delete an existing customer
   *
   * @param customer Id
   * @return true or false whether the customer is deleted or not
   */
  public boolean delCustomer(String customerId) throws RemoteException {
    USFEnv.getLog().writeWarn(" Inside delCustomer", this, null);
    boolean bTmp = false;

    // Get the connection
    RhccCustInfos rhcc_obj = new RhccCustInfos(conn);

    try {
      if (conn != null) {
        bTmp = rhcc_obj.deleteCustomer(Long.parseLong(customerId));
        USFEnv.getLog()
            .writeDebug("delCustomer DB connection, ref: " + conn.toString(), this, null);
      }
    } catch (Exception e) {
      USFEnv.getLog().writeCrit("Error in business EJB: ", this, e);
    }
    return bTmp;
  }
Esempio n. 2
0
  /**
   * Business unit of work This method is used to update an existing customer after editing
   *
   * @param customer details
   * @return true or false whether the customer is updated or not
   */
  public boolean updateCustomer(RhccCustInfos updateCustomer) throws RemoteException {
    USFEnv.getLog().writeWarn(" Inside updateCustomer", this, null);
    boolean bTmp = false;

    // Get the connection
    RhccCustInfos rhcc_obj = new RhccCustInfos(conn);

    try {
      if (conn != null) {
        bTmp = rhcc_obj.updateCustomerInfo(updateCustomer);
        USFEnv.getLog()
            .writeDebug("newCustomer DB connection, ref: " + conn.toString(), this, null);
      }
    } catch (Exception e) {
      USFEnv.getLog().writeCrit("Error in business EJB: ", this, e);
    }
    return bTmp;
  }
Esempio n. 3
0
  /**
   * Business unit of work This method is used to view a particular selected Customer
   *
   * @param customer Id
   * @return customer details
   */
  public RhccCustInfos viewCustomer(String customerId) throws RemoteException {
    RhccCustInfos cTmp = null;

    USFEnv.getLog().writeWarn(" Inside viewCustomer", this, null);

    // Get the connection
    RhccCustInfos rhcc_obj = new RhccCustInfos(conn);
    try {
      if (conn != null) {
        cTmp = rhcc_obj.searchCustomerInfo(customerId);
        USFEnv.getLog()
            .writeDebug("viewCustomer DB connection, ref: " + conn.toString(), this, null);
      }
    } catch (Exception e) {
      USFEnv.getLog().writeCrit("Error in business EJB: ", this, e);
    }
    return cTmp;
  }
Esempio n. 4
0
  /**
   * Business unit of work This method show all the RHCC customers for a funding year
   *
   * @param year - funding year
   * @return vCustnmid - Customers for a Funding Year
   */
  public Vector getAllRHCCCustomers(short year) throws RemoteException, NullPointerException {
    Vector vCustnmid = null;

    USFEnv.getLog().writeWarn("Inside getAllRHCCCustomers", this, null);

    // Get the connection

    RhccCustInfos rhcc_obj = new RhccCustInfos();
    try {

      vCustnmid = rhcc_obj.getAllRHCCCustomers(year);
      USFEnv.getLog()
          .writeDebug("getAllRHCCCustomers DB connection, ref: " + conn.toString(), this, null);

    } catch (Exception e) {
      USFEnv.getLog().writeCrit("Error in business EJB: ", this, e);
    }
    return vCustnmid;
  }
Esempio n. 5
0
  /**
   * Business unit of work This method is used to save a new Customer or an existing customer after
   * editing
   *
   * @param new customer details
   * @return true or false whether the customer is saved or not
   */
  public boolean saveCustomer(RhccCustInfos saveCustomer, Hashtable custErrors)
      throws RemoteException {
    USFEnv.getLog().writeWarn(" Inside saveCustomer", this, null);

    long customerId;
    boolean bCustErr = false;
    boolean bTmp = false;

    // Get the connection
    RhccCustInfos rhcc_obj = new RhccCustInfos(conn);

    try {
      customerId = saveCustomer.getCustomerId();

      if (conn != null) {
        USFEnv.getLog()
            .writeDebug("saveCustomer DB connection, ref: " + conn.toString(), this, null);
      }
      // Check business logic field value validation
      bCustErr = rhcccustValidate.customerBusVal(saveCustomer, custErrors);

      // Check if critial error occured
      if (!bCustErr) {
        // Saving a new customer
        if (customerId == 0) {
          // One time funding year set for new customer record
          bTmp = newCustomer(saveCustomer);

          USFEnv.getLog()
              .writeWarn(
                  "new RhccCustInfo created, RCI_ID: " + saveCustomer.getCustomerId(), this, null);
        } else {
          // Saving an exiting customer
          bTmp = updateCustomer(saveCustomer);
        }
      }

    } catch (Exception e) {
      USFEnv.getLog().writeCrit("Error in business EJB: ", this, e);
    }
    return bTmp;
  }