Commit 8ab9c3c7 authored by huriarte's avatar huriarte

Multitenant

parent 3ef875e5
......@@ -7,6 +7,7 @@ import com.bytesw.bytebot.http.FileValidationResponse;
import com.bytesw.bytebot.service.AgentService;
import com.bytesw.bytebot.service.FileManagementService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.multitenant.core.ThreadLocalStorage;
import com.bytesw.xdf.sql.beans.Pagination;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
......@@ -40,7 +41,7 @@ public class AgentController {
@PostMapping(value = "/page")
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> paginationCommercialEquivalence(@RequestBody Pagination<AgentBean> pagination) {
public ResponseEntity<String> paginationConversationalAgent(@RequestBody Pagination<AgentBean> pagination) {
HttpStatus hs = HttpStatus.OK;
try {
......@@ -56,7 +57,7 @@ public class AgentController {
@GetMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'view')")
public ResponseEntity<String> getExternalSystemServiceById(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
public ResponseEntity<String> getConversartionalAgentById(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
HttpStatus hs = HttpStatus.OK;
try {
......@@ -71,7 +72,7 @@ public class AgentController {
@PostMapping(value = "/")
@PreAuthorize("hasPermission(this, 'new')")
public ResponseEntity<String> createExternalSystem(@RequestBody AgentBean agentBean) {
public ResponseEntity<String> createConversationalAgent(@RequestBody AgentBean agentBean) {
HttpStatus hs = HttpStatus.OK;
......@@ -88,7 +89,7 @@ public class AgentController {
@PostMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'edit')")
public ResponseEntity<String> updateExternalSystem(@PathVariable("id") Long id,
public ResponseEntity<String> updateConversationalAgent(@PathVariable("id") Long id,
@RequestBody AgentBean agentBean) {
HttpStatus hs = HttpStatus.OK;
......@@ -110,7 +111,7 @@ public class AgentController {
@DeleteMapping(value = "/{id}")
@PreAuthorize("hasPermission(this, 'delete')")
public ResponseEntity<String> deleteExternalSystem(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
public ResponseEntity<String> deleteConversationalAgent(@ApiParam(value = "id", required = true) @PathVariable("id") Long id) {
HttpStatus hs = HttpStatus.OK;
try {
......
......@@ -25,6 +25,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
@Service
@Transactional
@Log4j2
public class AgentService extends CustomPaginationService<Agent> {
......@@ -54,8 +55,7 @@ public class AgentService extends CustomPaginationService<Agent> {
@Autowired
private ProducerTemplate producerTemplate;
@Transactional(transactionManager = "bytebotTransactionManager", readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public void searchByPagination(Pagination<AgentBean> pagination) {
if (pagination.getItemsPerPage() == 0) {
pagination.setItemsPerPage(10);
......@@ -95,7 +95,7 @@ public class AgentService extends CustomPaginationService<Agent> {
pagination.setData(list);
}
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.REQUIRED)
@Transactional(propagation = Propagation.REQUIRED)
public void save(AgentBean agent) {
boolean isModify = true;
......@@ -314,7 +314,6 @@ public class AgentService extends CustomPaginationService<Agent> {
}
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.NOT_SUPPORTED)
public AgentBean getAgent(Long id) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
......@@ -399,7 +398,7 @@ public class AgentService extends CustomPaginationService<Agent> {
return bean;
}
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.REQUIRED)
@Transactional(propagation = Propagation.REQUIRED)
public boolean delete(Long id) {
boolean isValid = true;
......@@ -416,8 +415,7 @@ public class AgentService extends CustomPaginationService<Agent> {
return isValid;
}
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public List<CountryBean> getCountries() {
List<CountryBean> countriesBean = new ArrayList<>();
List<Country> countries = (List<Country>) countryRepository.findAll();
......@@ -429,7 +427,6 @@ public class AgentService extends CustomPaginationService<Agent> {
return countriesBean;
}
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public List<ChannelBean> getChannels() {
List<ChannelBean> channelsBean = new ArrayList<>();
List<Channel> channels = (List<Channel>) channelRepository.findAll();
......@@ -441,7 +438,7 @@ public class AgentService extends CustomPaginationService<Agent> {
return channelsBean;
}
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.REQUIRED)
@Transactional(propagation = Propagation.REQUIRED)
public void synchronizeFiles(Long id, String user) {
List<FrequentQuestion> frequentQuestions = frequentQuestionRepository.findAllByAgentIdAndStatus(id, FrequentQuestionStatusEnum.PENDING_SYNCHRONIZED);
......
......@@ -38,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@Service
@Transactional
@Log4j2
public class FileManagementService {
......@@ -47,7 +48,7 @@ public class FileManagementService {
@Autowired
private QuestionFileRepository questionFileRepository;
@Transactional(transactionManager = "bytebotTransactionManager", propagation = Propagation.REQUIRED)
@Transactional(propagation = Propagation.REQUIRED)
public FileValidationResponse validateAndSaveFile(String uuid, MultipartFile file) throws IOException {
FileValidationResponse response = new FileValidationResponse();
......
......@@ -12,14 +12,6 @@
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<context:annotation-config />
<jpa:repositories base-package="com.bytesw.xdf.dao" />
<jpa:repositories base-package="com.bytesw.xdf.security.dao" />
<jpa:repositories base-package="com.bytesw.bytebot.dao" />
<!-- <jpa:repositories base-package="com.bytesw.xdf.license.dao" />-->
<!-- <jpa:repositories base-package="com.bytesw.xdf.statistics.dao" />-->
<!--<context:component-scan base-package="com.bytesw.coreweb.seguridad.dao.jdbc" />-->
<jpa:repositories base-package="com.bytesw" transaction-manager-ref="transactionManager" entity-manager-factory-ref="entityManagerFactory"/>
</beans>
\ No newline at end of file
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