Commit bb9f7965 by neel

SQL server migration key to property changes

parent 2f3ab201
...@@ -35,7 +35,7 @@ public class DBConfig { ...@@ -35,7 +35,7 @@ public class DBConfig {
for(Configurations configuration : configurations) { for(Configurations configuration : configurations) {
System.out.println("configurations"); System.out.println("configurations");
System.out.println(configurations); System.out.println(configurations);
configs.put(configuration.getKey(), configuration.getValue()); configs.put(configuration.getProperty(), configuration.getValue());
System.out.println("configs"); System.out.println("configs");
System.out.println(configs); System.out.println(configs);
......
...@@ -30,7 +30,7 @@ public class TemplateConfig { ...@@ -30,7 +30,7 @@ public class TemplateConfig {
List<Templates> templates = templatesService.findAll(); List<Templates> templates = templatesService.findAll();
configs = new JSONObject(); configs = new JSONObject();
for(Templates configuration : templates) { for(Templates configuration : templates) {
configs.put(configuration.getKey(), configuration.getValue()); configs.put(configuration.getProperty(), configuration.getValue());
} }
} }
public String getValue(String key) { public String getValue(String key) {
......
...@@ -26,7 +26,7 @@ public class Configurations{ ...@@ -26,7 +26,7 @@ public class Configurations{
@NotBlank @NotBlank
@Column(length=50) @Column(length=50)
private String key; private String property;
@NotBlank @NotBlank
@Column(length=500) @Column(length=500)
......
...@@ -27,7 +27,7 @@ public class Templates{ ...@@ -27,7 +27,7 @@ public class Templates{
@NotBlank @NotBlank
@Column(length=50) @Column(length=50)
private String key; private String property;
@NotBlank @NotBlank
@Lob @Lob
......
...@@ -28,7 +28,7 @@ public class ConfigurationsDto{ ...@@ -28,7 +28,7 @@ public class ConfigurationsDto{
private String isFrontEnd; private String isFrontEnd;
public ConfigurationsDto(Configurations configurations) { public ConfigurationsDto(Configurations configurations) {
this.key = configurations.getKey(); this.key = configurations.getProperty();
this.value = configurations.getValue(); this.value = configurations.getValue();
this.description = configurations.getDescription(); this.description = configurations.getDescription();
this.isFrontEnd = configurations.getIsFrontEnd(); this.isFrontEnd = configurations.getIsFrontEnd();
......
...@@ -28,7 +28,7 @@ public class TemplatesDto{ ...@@ -28,7 +28,7 @@ public class TemplatesDto{
private TemplateType type; private TemplateType type;
public TemplatesDto(Templates template) { public TemplatesDto(Templates template) {
this.key = template.getKey(); this.key = template.getProperty();
this.value = template.getValue(); this.value = template.getValue();
this.type = template.getType(); this.type = template.getType();
} }
......
...@@ -4,6 +4,8 @@ import java.util.List; ...@@ -4,6 +4,8 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import com.ic.constant.DBConfig; import com.ic.constant.DBConfig;
import com.ic.exception.ResourceNotFoundException; import com.ic.exception.ResourceNotFoundException;
...@@ -26,7 +28,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService { ...@@ -26,7 +28,7 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Config","key",dto.getKey())); configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Config","key",dto.getKey()));
}else { }else {
configuration = new Configurations(); configuration = new Configurations();
configuration.setKey(dto.getKey()); configuration.setProperty(dto.getKey());
} }
configuration.setValue(dto.getValue()); configuration.setValue(dto.getValue());
configuration.setDescription(dto.getDescription()); configuration.setDescription(dto.getDescription());
...@@ -34,9 +36,11 @@ public class ConfigurationsServiceImpl implements ConfigurationsService { ...@@ -34,9 +36,11 @@ public class ConfigurationsServiceImpl implements ConfigurationsService {
return configRepo.save(configuration); return configRepo.save(configuration);
} }
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public List<Configurations> findAll(){ public List<Configurations> findAll(){
return configRepo.findAll(); return configRepo.findAll();
} }
@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.findByKey(key).orElseThrow(()->new ResourceNotFoundException("Config","key",key));
} }
......
...@@ -4,6 +4,8 @@ import java.util.List; ...@@ -4,6 +4,8 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import com.ic.constant.TemplateConfig; import com.ic.constant.TemplateConfig;
import com.ic.exception.ResourceNotFoundException; import com.ic.exception.ResourceNotFoundException;
...@@ -27,7 +29,7 @@ public class TemplatesServiceImpl implements TemplatesService { ...@@ -27,7 +29,7 @@ public class TemplatesServiceImpl implements TemplatesService {
configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Template","key",dto.getKey())); configRepo.findByKey(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Template","key",dto.getKey()));
}else { }else {
configuration = new Templates(); configuration = new Templates();
configuration.setKey(dto.getKey()); configuration.setProperty(dto.getKey());
} }
configuration.setValue(dto.getValue()); configuration.setValue(dto.getValue());
configuration.setType(dto.getType()); configuration.setType(dto.getType());
...@@ -35,9 +37,11 @@ public class TemplatesServiceImpl implements TemplatesService { ...@@ -35,9 +37,11 @@ public class TemplatesServiceImpl implements TemplatesService {
return configRepo.save(configuration); return configRepo.save(configuration);
} }
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public List<Templates> findAll(){ public List<Templates> findAll(){
return configRepo.findAll(); return configRepo.findAll();
} }
@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.findByKey(key).orElseThrow(()->new ResourceNotFoundException("Template","key",key));
} }
......
package com.ic.modules.auth.service.impl; package com.ic.modules.auth.service.impl;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -10,10 +7,10 @@ import org.springframework.data.domain.Page; ...@@ -10,10 +7,10 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.ic.exception.ResourceNotFoundException;
import com.ic.modules.auth.model.User; import com.ic.modules.auth.model.User;
import com.ic.modules.auth.payload.UserDto; import com.ic.modules.auth.payload.UserDto;
import com.ic.modules.auth.repository.UserRepository; import com.ic.modules.auth.repository.UserRepository;
...@@ -30,6 +27,7 @@ public class UserServiceImpl implements UserService { ...@@ -30,6 +27,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public Page<User> findAll(Pageable pageable) { public Page<User> findAll(Pageable pageable) {
return userRepository.findAll(pageable); return userRepository.findAll(pageable);
} }
...@@ -66,6 +64,7 @@ public class UserServiceImpl implements UserService { ...@@ -66,6 +64,7 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@Transactional(isolation=Isolation.READ_UNCOMMITTED)
public User findById(String id) { public User findById(String id) {
User user = userRepository.findByUserId(id.trim()); User user = userRepository.findByUserId(id.trim());
......
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