Package com.ateam.webstore.service.impl

Source Code of com.ateam.webstore.service.impl.CreditCardService

/**
*
*/
package com.ateam.webstore.service.impl;

import java.io.Serializable;
import java.util.Collection;

import com.ateam.webstore.dao.CreditCardDAO;
import com.ateam.webstore.model.CreditCard;
import com.ateam.webstore.model.Customer;
import com.ateam.webstore.service.RepositoryService;

/**
* @author Hendrix Tavarez
*
*/
public class CreditCardService implements RepositoryService<CreditCard> {

  @Override
  public CreditCard store(CreditCard creditCard) {

    CreditCardDAO repository = new CreditCardDAO()
    return repository.save(creditCard);
   
  }

  @Override
  public void remove(CreditCard creditCard) {
   
    CreditCardDAO repository = new CreditCardDAO();
    repository.delete(creditCard);
   
  }

  @Override
  public Collection<CreditCard> getAll() {

    CreditCardDAO repository = new CreditCardDAO();
    return repository.getAll();
   
  }

  @Override
  public CreditCard getById(Serializable id) {
    CreditCardDAO repository = new CreditCardDAO();
    return repository.get(id);
  }
 
  public Collection<CreditCard> getByCustomerId(Serializable id) {
    CreditCardDAO repository = new CreditCardDAO();
    Customer customer = new CustomerService().getById(id);
    return repository.getByCustomer(customer);
  }

}
TOP

Related Classes of com.ateam.webstore.service.impl.CreditCardService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.