package devopsdistilled.operp.server.data.service.items.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import devopsdistilled.operp.server.data.entity.items.Brand;
import devopsdistilled.operp.server.data.entity.items.Item;
import devopsdistilled.operp.server.data.entity.items.Product;
import devopsdistilled.operp.server.data.repo.items.ItemRepository;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;
import devopsdistilled.operp.server.data.service.items.ItemService;

@Service
public class ItemServiceImpl extends
		AbstractEntityService<Item, Long, ItemRepository> implements
		ItemService {

	private static final long serialVersionUID = 7578267584162733059L;

	@Inject
	private ItemRepository itemRepository;

	@Override
	protected ItemRepository getRepo() {
		return itemRepository;
	}

	@Override
	public boolean isProductBrandPairExists(Product product, Brand brand) {
		List<Item> items = itemRepository.findByProductAndBrand(product, brand);
		if (items.size() == 0)
			return false;
		else
			return true;
	}

	@Override
	public boolean isItemNameExists(String itemName) {
		List<Item> items = itemRepository.findByItemName(itemName);
		if (items.size() == 0)
			return false;
		else
			return true;
	}
}

@@ -60,32 +60,8 @@
 l;%0A%0A
-import java.util.List;%0A%0A
 impo
@@ -940,32 +940,25 @@
 nd) %7B%0A%09%09
-List%3C
 Item
-%3E
  item
-s
  = itemR
@@ -1012,37 +1012,32 @@
 ;%0A%09%09if (item
-s.size() == 0
+ != null
 )%0A%09%09%09return 
@@ -1028,36 +1028,35 @@
 null)%0A%09%09%09return 
-fals
+tru
 e;%0A%09%09else%0A%09%09%09ret
@@ -1055,27 +1055,28 @@
 e%0A%09%09%09return 
-tru
+fals
 e;%0A%09%7D%0A%0A%09@Ove
@@ -1139,24 +1139,17 @@
 %7B%0A%09%09
-List%3C
 Item
-%3E
  item
-s
  = i
@@ -1188,16 +1188,17 @@
 mName);%0A
+%0A
 %09%09if (it
@@ -1203,21 +1203,16 @@
 item
-s.size() == 0
+ != null
 )%0A%09%09
@@ -1215,28 +1215,27 @@
 )%0A%09%09%09return 
-fals
+tru
 e;%0A%09%09else%0A%09%09
@@ -1238,23 +1238,24 @@
 e%0A%09%09%09return 
-tru
+fals
 e;%0A%09%7D%0A%7D%0A

Add method definitions