public class SaleFacadeImpl extends Object implements SaleFacade
| Constructor and Description |
|---|
SaleFacadeImpl(SaleService saleService,
ItemService itemService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Sale |
addSale(long ean,
Date date,
int sold)
Adds one sale
|
List<Sale> |
getAllSales()
Get all sales
|
List<Sale> |
getSalesForCategory(Category category,
Date from,
Date to)
Get all sales for given category from given period of time
|
List<Sale> |
getSalesForProduct(Item item,
Date from,
Date to)
Get all sales for given item from given period of time
|
Sale |
storeSaleInDb(Sale s)
Store sale in db.
|
public SaleFacadeImpl(SaleService saleService, ItemService itemService)
saleService - saleServiceitemService - itemServicepublic Sale addSale(long ean, Date date, int sold) throws EntityDoesNotExistException, NotEnoughStoredException
SaleFacadeaddSale in interface SaleFacadeean - EAN of itemdate - date of salesold - items soldEntityDoesNotExistException - if item with this EAN doesn't existNotEnoughStoredException - if there is not enough items of this item storedpublic Sale storeSaleInDb(Sale s) throws ServiceException
SaleFacadestoreSaleInDb in interface SaleFacades - sale to storeServiceException - if sale is invalid or some error occurspublic List<Sale> getSalesForCategory(Category category, Date from, Date to) throws IllegalArgumentException
SaleFacadegetSalesForCategory in interface SaleFacadecategory - categoryfrom - minimum date for salesto - maximum date for salesIllegalArgumentException - if category is nullpublic List<Sale> getSalesForProduct(Item item, Date from, Date to) throws IllegalArgumentException
SaleFacadegetSalesForProduct in interface SaleFacadeitem - itemfrom - minimum date for salesto - maximum date for salesIllegalArgumentException - item is nullpublic List<Sale> getAllSales()
SaleFacadegetAllSales in interface SaleFacadeCopyright © 2017 Pivotal Software, Inc.. All rights reserved.