Class CustomerDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.dao.customer.CustomerDAO
Direct Known Subclasses:
CustomerDAO

public class CustomerDAO extends CommonDAO
  • Constructor Details

    • CustomerDAO

      public CustomerDAO(Connection con)
    • CustomerDAO

      public CustomerDAO(Connection con, boolean history, int userId)
  • Method Details

    • searchCustomerList

      public void searchCustomerList(Pageable<Customer> searchResult, String title)
      Selects customers by title
      Parameters:
      searchResult -
      title -
    • searchCustomerListByEmail

      public void searchCustomerListByEmail(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> emailParamIdList, String email)
      Selects customers by an Email-type parameter
      Parameters:
      searchResult -
      emailParamIdList -
      email - Email, search is done by exact match and domain match
    • searchCustomerListByText

      public void searchCustomerListByText(Pageable<Customer> searchResult, List<Integer> textParamIdList, String value) throws SQLException
      Selects customers by a text parameter
      Parameters:
      searchResult -
      textParamIdList -
      value -
      Throws:
      SQLException
    • searchCustomerListByAddress

      public void searchCustomerListByAddress(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int streetId, String house, String houseFlat, String houseRoom) throws SQLException
      Selects customers by an address parameter
      Parameters:
      searchResult -
      addressParamIdList -
      streetId -
      house -
      houseFlat -
      houseRoom -
      Throws:
      SQLException
    • searchCustomerListByAddress

      public void searchCustomerListByAddress(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int houseId, String houseFlat, String houseRoom)
      Selects customers by an address parameter
      Parameters:
      searchResult -
      addressParamIdList -
      houseId - house code
      houseFlat - flat
      houseRoom - room
    • searchCustomerListByPhone

      public void searchCustomerListByPhone(Pageable<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers)
      Selects customers by a phone number or numbers
      Parameters:
      searchResult -
      phoneParamIdList -
      phoneNumbers -
    • getCustomerById

      public Customer getCustomerById(int customerId)
      Selects a customer by its code
      Parameters:
      customerId -
      Returns:
      the customer
    • updateCustomer

      public void updateCustomer(Customer customer) throws SQLException
      Updates customer information in DB
      Parameters:
      customer -
      Throws:
      SQLException
    • deleteCustomer

      public void deleteCustomer(int id) throws SQLException
      Deletes a customer from DB by code
      Parameters:
      id -
      Throws:
      SQLException
    • updateCustomerTitle

      public void updateCustomerTitle(String titleBefore, Customer customer, int changedParamId, Response response) throws Exception
      Updates the customer's title, generating it from parameters
      Parameters:
      titleBefore - the original title
      customer - the customer
      changedParamId - the changed parameter's code
      response - if passed, an event about the title change will be added there
      Throws:
      Exception
    • getCustomerTitles

      public List<String> getCustomerTitles(String title, int count)
      Returns customer titles containing a substring
      Parameters:
      title - the substring, search uses a LIKE expression
      count - count of the first titles
      Returns:
      the titles
    • getGroupIds

      public Set<Integer> getGroupIds(int customerId) throws SQLException
      Throws:
      SQLException
    • updateGroupIds

      public void updateGroupIds(int customerId, Set<Integer> groupIds) throws SQLException
      Throws:
      SQLException
    • getCustomerFromRs

      public static Customer getCustomerFromRs(ResultSet rs, String prefix) throws SQLException
      Returns a created Customer object filled from ResultSet
      Parameters:
      rs -
      prefix -
      Throws:
      SQLException
    • searchCustomerList

      @Deprecated public void searchCustomerList(Pageable<Customer> searchResult, Set<Integer> groupIds)
      Deprecated.
    • extractCustomerWithRef

      @Deprecated public Customer extractCustomerWithRef(int customerId)
      Deprecated.
    • searchCustomerByLinkedObjectTitle

      @Deprecated public void searchCustomerByLinkedObjectTitle(Pageable<Customer> searchResult, String linkedObjectTypeLike, String linkedObjectTitle)
      Deprecated.
    • getCustomerByTitle

      @Deprecated public Customer getCustomerByTitle(String customerTitle) throws SQLException
      Deprecated.
      Throws:
      SQLException