Commit f4857f20 by neel

SQl server migration Key to property change

parent bb9f7965
...@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import com.ic.modules.auth.model.Configurations; import com.ic.modules.auth.model.Configurations;
public interface ConfigurationsRepository extends JpaRepository<Configurations, Long>{ 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; ...@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import com.ic.modules.auth.model.Templates; import com.ic.modules.auth.model.Templates;
public interface TemplatesRepository extends JpaRepository<Templates, Long>{ 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 { ...@@ -25,7 +25,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
public Configurations save(ConfigurationsDto dto,Boolean isCreate) { public Configurations save(ConfigurationsDto dto,Boolean isCreate) {
Configurations configuration = null; Configurations configuration = null;
if(!isCreate) { 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 { }else {
configuration = new Configurations(); configuration = new Configurations();
configuration.setProperty(dto.getKey()); configuration.setProperty(dto.getKey());
...@@ -42,7 +42,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService { ...@@ -42,7 +42,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
} }
@Transactional(isolation=Isolation.READ_UNCOMMITTED) @Transactional(isolation=Isolation.READ_UNCOMMITTED)
public Configurations findByKey(String key) { 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 { ...@@ -26,7 +26,7 @@ public class TemplatesServiceImpl implements TemplatesService {
public Templates save(TemplatesDto dto,Boolean isCreate) { public Templates save(TemplatesDto dto,Boolean isCreate) {
Templates configuration = null; Templates configuration = null;
if(!isCreate) { 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 { }else {
configuration = new Templates(); configuration = new Templates();
configuration.setProperty(dto.getKey()); configuration.setProperty(dto.getKey());
...@@ -43,7 +43,7 @@ public class TemplatesServiceImpl implements TemplatesService { ...@@ -43,7 +43,7 @@ public class TemplatesServiceImpl implements TemplatesService {
} }
@Transactional(isolation=Isolation.READ_UNCOMMITTED) @Transactional(isolation=Isolation.READ_UNCOMMITTED)
public Templates findByKey(String key) { 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