public class ItemServiceImpl extends Object implements ItemService
Constructor and Description |
---|
ItemServiceImpl(ItemRepository itemRepository)
Constructor
|
Modifier and Type | Method and Description |
---|---|
long |
create(Item item)
Creates new item
|
void |
delete(Item item)
Deletes item
|
List<Item> |
getAllItems()
Returns list of all items
|
List<Item> |
getByCategory(Category c)
Returns all items belonging to given category
|
Item |
getByEan(long ean)
Return item of given ean
|
Item |
getById(long id)
Return item of given id
|
void |
update(Item item)
Updates item
|
public ItemServiceImpl(ItemRepository itemRepository)
itemRepository
- item repositorypublic long create(Item item) throws ServiceException
ItemService
create
in interface ItemService
item
- Item to be createdServiceException
- when there are any unexpected problemspublic void update(Item item) throws ServiceException
ItemService
update
in interface ItemService
item
- Item to be updatedServiceException
- when there are any unexpected problemspublic void delete(Item item) throws ServiceException
ItemService
delete
in interface ItemService
item
- Item to be deletedServiceException
- when there are any unexpected problemspublic Item getById(long id)
ItemService
getById
in interface ItemService
id
- Id of itempublic Item getByEan(long ean)
ItemService
getByEan
in interface ItemService
ean
- EAN of itempublic List<Item> getByCategory(Category c)
ItemService
getByCategory
in interface ItemService
c
- categorypublic List<Item> getAllItems()
ItemService
getAllItems
in interface ItemService
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.