public class ItemFacadeImpl extends Object implements ItemFacade
| Constructor and Description |
|---|
ItemFacadeImpl(ItemService itemService,
CategoryService categoryService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Item |
changeItem(String newName,
String newDescription,
String newCategory,
Integer newAlertThreshold,
String newUnit,
Item item)
Updates existing item, but doesn't store it in db
|
Pair<Item,CreateOrUpdate> |
createOrUpdateItem(String name,
String description,
String categoryName,
Integer alertThreshold,
String unit,
long ean)
Creates a new item, or updates it if it already exist but doesn't do the actual storing in db
|
List<Item> |
getAllItems()
Return all items
|
List<Item> |
getAllItemsByCategory(String categoryName)
Return all items with given category
|
Item |
getItemByEan(long ean)
Gets item by its ean
|
Item |
storeItemInDb(Pair<Item,CreateOrUpdate> i)
Item will be created in db
|
Item |
updateItemFromWeb(long ean,
int newAmount,
Integer newThreshold,
String newUnit)
For updating items from web interface
|
public ItemFacadeImpl(ItemService itemService, CategoryService categoryService)
itemService - itemServicecategoryService - categoryServicepublic Pair<Item,CreateOrUpdate> createOrUpdateItem(String name, String description, String categoryName, Integer alertThreshold, String unit, long ean) throws EntityDoesNotExistException
ItemFacadecreateOrUpdateItem in interface ItemFacadename - name of itemdescription - description of item, null if there should be nonecategoryName - name of category of this item, must be already in db, cause @EntityDoesNotExistException if it is not therealertThreshold - alert threshold for item, null if there is noneunit - unit for measuring the itemean - ean of item, unique identifierEntityDoesNotExistException - if category is not in dbpublic Item changeItem(String newName, String newDescription, String newCategory, Integer newAlertThreshold, String newUnit, Item item) throws EntityDoesNotExistException
ItemFacadechangeItem in interface ItemFacadenewName - New name of itemnewDescription - New description of item, null if there should be nonenewCategory - New category of item, must be in db, cause @EntityDoesNotExistException if it is not therenewAlertThreshold - New alert threshold of item, or nullnewUnit - New unit of itemitem - item to be changedEntityDoesNotExistException - if category is not in dbpublic List<Item> getAllItems()
ItemFacadegetAllItems in interface ItemFacadepublic List<Item> getAllItemsByCategory(String categoryName) throws EntityDoesNotExistException
ItemFacadegetAllItemsByCategory in interface ItemFacadecategoryName - name of the categoryEntityDoesNotExistException - if category is not in the dbpublic Item updateItemFromWeb(long ean, int newAmount, Integer newThreshold, String newUnit) throws ServiceException, EntityDoesNotExistException
ItemFacadeupdateItemFromWeb in interface ItemFacadeean - ean of item to be updatednewAmount - new amount of itemnewThreshold - new threshold, null if it will be left unfilled or somethingnewUnit - new unitServiceException - if something goes wrong on the db layer and service layer cannot deal with itEntityDoesNotExistException - if item with this ean is not in dbpublic Item getItemByEan(long ean)
ItemFacadegetItemByEan in interface ItemFacadeean - ean of itempublic Item storeItemInDb(Pair<Item,CreateOrUpdate> i) throws ServiceException
ItemFacadestoreItemInDb in interface ItemFacadei - item to be createdServiceException - if something goes wrong on the db layer and service layer cannot deal with itCopyright © 2017 Pivotal Software, Inc.. All rights reserved.