Exemplo n.º 1
0
  @Override
  public boolean addCustomer(Customer customer) {
    if (null == customer) {
      throw new IllegalArgumentException("customer is null");
    }

    if (customer.getId() == null) customer.setId(customerDao.getNextSequenceNumber());
    return customerDao.insert(customer);
  }
Exemplo n.º 2
0
  @Override
  public Customer findCustomer(Integer customerId) {
    if (null == customerId) {
      throw new IllegalArgumentException("customerId is null");
    }

    return customerDao.query(customerId);
  }
Exemplo n.º 3
0
  @Override
  public boolean removeCustomer(Integer customerId) {
    if (null == customerId) {
      throw new IllegalArgumentException("customer is null");
    }

    Customer customer = new Customer();
    customer.setId(customerId);
    int rowAffected = customerDao.delete(customer);
    return rowAffected > 0;
  }
Exemplo n.º 4
0
 @Override
 public Integer getNextSequenceNumber() {
   return customerDao.getNextSequenceNumber();
 }
Exemplo n.º 5
0
 @Override
 public List<Customer> findAllCustomers() {
   return customerDao.queryALl();
 }
Exemplo n.º 6
0
 @Override
 public boolean updateCustomer(Integer customerId, Customer customer) {
   customer.setId(customerId);
   int rowAffected = customerDao.update(customer);
   return rowAffected > 0;
 }