class ProductTypeServiceImpl extends SalesManagerEntityServiceImpl<Long, ProductType>
		implements ProductTypeService {

	private ProductTypeRepository productTypeRepository;
	
	@Autowired
	private PageableProductTypeRepository pageableProductTypeRepository;

	@Inject
	public ProductTypeServiceImpl(ProductTypeRepository productTypeRepository) {
		super(productTypeRepository);
		this.productTypeRepository = productTypeRepository;
	}

	@Override
	public ProductType getByCode(String code, MerchantStore store, Language language) throws ServiceException {
		return productTypeRepository.findByCode(code, store.getId());
	}

	@Override
	public void update(String code, MerchantStore store, ProductType type) throws ServiceException {
		productTypeRepository.save(type);

	}
	
	@Override
	public ProductType getProductType(String productTypeCode) {
		return productTypeRepository.findByCode(productTypeCode);
	}

	@Override
	public Page<ProductType> getByMerchant(MerchantStore store, Language language, int page, int count) throws ServiceException {
		Pageable pageRequest = PageRequest.of(page, count);
		return pageableProductTypeRepository.listByStore(store.getId(), pageRequest);
	}

	@Override
	public ProductType getById(Long id, MerchantStore store, Language language) throws ServiceException {
		return productTypeRepository.findById(id, store.getId(), language.getId());
	}

	@Override
	public ProductType saveOrUpdate(ProductType productType) throws ServiceException {<FILL_FUNCTION_BODY>}

	@Override
	public List<ProductType> listProductTypes(List<Long> ids, MerchantStore store, Language language)
			throws ServiceException {
		return productTypeRepository.findByIds(ids, store.getId(), language.getId());
	}

	@Override
	public ProductType getById(Long id, MerchantStore store) throws ServiceException {
		return productTypeRepository.findById(id, store.getId());
	}


}

		if(productType.getId()!=null && productType.getId() > 0) {
			this.update(productType);
		} else {
			productType = super.saveAndFlush(productType);
		}
		
		return productType;
	
<methods>public void <init>(JpaRepository<com.salesmanager.core.model.catalog.product.type.ProductType,java.lang.Long>) ,public java.lang.Long count() ,public void create(com.salesmanager.core.model.catalog.product.type.ProductType) throws com.salesmanager.core.business.exception.ServiceException,public void delete(com.salesmanager.core.model.catalog.product.type.ProductType) throws com.salesmanager.core.business.exception.ServiceException,public void flush() ,public com.salesmanager.core.model.catalog.product.type.ProductType getById(java.lang.Long) ,public List<com.salesmanager.core.model.catalog.product.type.ProductType> list() ,public void save(com.salesmanager.core.model.catalog.product.type.ProductType) throws com.salesmanager.core.business.exception.ServiceException,public void saveAll(Iterable<com.salesmanager.core.model.catalog.product.type.ProductType>) throws com.salesmanager.core.business.exception.ServiceException,public void update(com.salesmanager.core.model.catalog.product.type.ProductType) throws com.salesmanager.core.business.exception.ServiceException<variables>private Class<com.salesmanager.core.model.catalog.product.type.ProductType> objectClass,private JpaRepository<com.salesmanager.core.model.catalog.product.type.ProductType,java.lang.Long> repository