public class CategoryServiceImpl extends Object implements CategoryService
Constructor and Description |
---|
CategoryServiceImpl(CategoryRepository categoryRepository)
Construcot
|
Modifier and Type | Method and Description |
---|---|
long |
create(Category category)
Creates new category
|
void |
delete(Category category)
Deletes category
|
List<Category> |
getAllCategories()
Returns list of all categories
|
Category |
getById(long id)
Return category of given id
|
Category |
getByName(String name)
Return category of given name
|
void |
update(Category category)
Updates category
|
public CategoryServiceImpl(CategoryRepository categoryRepository)
categoryRepository
- category repositorypublic long create(Category category) throws ServiceException
CategoryService
create
in interface CategoryService
category
- Category to be createdServiceException
- when there are any unexpected problemspublic void delete(Category category) throws ServiceException
CategoryService
delete
in interface CategoryService
category
- Category to be deletedServiceException
- when there are any unexpected problemspublic void update(Category category) throws ServiceException
CategoryService
update
in interface CategoryService
category
- Category to be updatedServiceException
- when there are any unexpected problemspublic Category getById(long id)
CategoryService
getById
in interface CategoryService
id
- Id of categorypublic Category getByName(String name)
CategoryService
getByName
in interface CategoryService
name
- Name of categorypublic List<Category> getAllCategories()
CategoryService
getAllCategories
in interface CategoryService
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.