<commit_before>package devopsdistilled.operp.server.data.service.items.impl;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import devopsdistilled.operp.server.data.entity.items.Product;
import devopsdistilled.operp.server.data.repo.items.ProductRepository;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;
import devopsdistilled.operp.server.data.service.items.ProductService;

@Service
public class ProductServiceImpl extends
		AbstractEntityService<Product, Long, ProductRepository> implements
		ProductService {

	private static final long serialVersionUID = 8517308443607933958L;

	@Inject
	private ProductRepository productRepository;

	@Override
	protected ProductRepository getRepo() {
		return productRepository;
	}

	@Override
	public boolean isProductNameExists(String productName) {
		Product product = productRepository.findByProductName(productName);

		if (product != null)
			return true;

		return false;
	}

}
<commit_msg>Impl isProductNameValidForProduct<commit_after>package devopsdistilled.operp.server.data.service.items.impl;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import devopsdistilled.operp.server.data.entity.items.Product;
import devopsdistilled.operp.server.data.repo.items.ProductRepository;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;
import devopsdistilled.operp.server.data.service.items.ProductService;

@Service
public class ProductServiceImpl extends
		AbstractEntityService<Product, Long, ProductRepository> implements
		ProductService {

	private static final long serialVersionUID = 8517308443607933958L;

	@Inject
	private ProductRepository productRepository;

	@Override
	protected ProductRepository getRepo() {
		return productRepository;
	}

	@Override
	public boolean isProductNameExists(String productName) {
		Product product = productRepository.findByProductName(productName);

		if (product != null)
			return true;

		return false;
	}

	@Override
	public boolean isProductNameValidForProduct(Long productId,
			String productName) {

		Product product = productRepository.findByProductName(productName);

		if (product == null)
			return true;

		if (product.getProductId().equals(productId))
			return true;

		return false;
	}

}

{'fraction_non_alphanumeric': 0.078719723183391, 'fraction_numerical': 0.01643598615916955, 'mean_word_length': 6.116923076923077, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4049867', 'n_tokens_mistral': 711, 'n_tokens_neox': 649, 'n_words': 132}