public interface ItemFacade
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
|
Pair<Item,CreateOrUpdate> createOrUpdateItem(String name, String description, String categoryName, Integer alertThreshold, String unit, long ean) throws EntityDoesNotExistException
name
- 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 dbItem changeItem(String newName, String newDescription, String newCategory, Integer newAlertThreshold, String newUnit, Item item) throws EntityDoesNotExistException
newName
- 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 dbItem getItemByEan(long ean)
ean
- ean of itemList<Item> getAllItemsByCategory(String categoryName) throws EntityDoesNotExistException
categoryName
- name of the categoryEntityDoesNotExistException
- if category is not in the dbItem updateItemFromWeb(long ean, int newAmount, Integer newThreshold, String newUnit) throws ServiceException, EntityDoesNotExistException
ean
- 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 dbItem storeItemInDb(Pair<Item,CreateOrUpdate> i) throws ServiceException
i
- 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.