Commit f4857f20 by neel

SQl server migration Key to property change

parent bb9f7965
......@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import com.ic.modules.auth.model.Configurations;
public interface ConfigurationsRepository extends JpaRepository<Configurations, Long>{
Optional<Configurations> findByKey(String key);
Optional<Configurations> findByProperty(String key);
}
......@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import com.ic.modules.auth.model.Templates;
public interface TemplatesRepository extends JpaRepository<Templates, Long>{
Optional<Templates> findByKey(String key);
Optional<Templates> findByProperty(String key);
}
......@@ -25,7 +25,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
public Configurations save(ConfigurationsDto dto,Boolean isCreate) {
Configurations configuration = null;
if(!isCreate) {
configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Config","key",dto.getKey()));
configRepo.findByProperty(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Config","key",dto.getKey()));
}else {
configuration = new Configurations();
configuration.setProperty(dto.getKey());
......@@ -42,7 +42,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
}
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public Configurations findByKey(String key) {
return configRepo.findByKey(key).orElseThrow(()->new ResourceNotFoundException("Config","key",key));
return configRepo.findByProperty(key).orElseThrow(()->new ResourceNotFoundException("Config","key",key));
}
}
......@@ -26,7 +26,7 @@ public class TemplatesServiceImpl implements TemplatesService {
public Templates save(TemplatesDto dto,Boolean isCreate) {
Templates configuration = null;
if(!isCreate) {
configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Template","key",dto.getKey()));
configRepo.findByProperty(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Template","key",dto.getKey()));
}else {
configuration = new Templates();
configuration.setProperty(dto.getKey());
......@@ -43,7 +43,7 @@ public class TemplatesServiceImpl implements TemplatesService {
}
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public Templates findByKey(String key) {
return configRepo.findByKey(key).orElseThrow(()->new ResourceNotFoundException("Template","key",key));
return configRepo.findByProperty(key).orElseThrow(()->new ResourceNotFoundException("Template","key",key));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment