package fr.eni.demo.bll; import fr.eni.demo.bo.Facture; import fr.eni.demo.dal.FactureRepository; import java.util.List; public class FactureServiceImpl implements FactureService { private final FactureRepository factureRepo; public FactureServiceImpl(FactureRepository factureRepo) { this.factureRepo = factureRepo; } @Override public List getByClient(Long clientId) { if (clientId == null) { throw new IllegalArgumentException("Client id can't be null"); } List factures = factureRepo.findByClient(clientId); if (factures == null) { throw new IllegalArgumentException("No factures found"); }; return factures; } @Override public List getAll() { return factureRepo.findAll(); } @Override public List getUnpayed() { return factureRepo.findByDatePayEmpty(); } }