Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ejercicio2-framework-back
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josue
ejercicio2-framework-back
Commits
8ab9c3c7
Commit
8ab9c3c7
authored
Sep 16, 2020
by
huriarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multitenant
parent
3ef875e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
24 deletions
+15
-24
AgentController.java
...n/java/com/bytesw/bytebot/controller/AgentController.java
+6
-5
AgentService.java
src/main/java/com/bytesw/bytebot/service/AgentService.java
+6
-9
FileManagementService.java
...ava/com/bytesw/bytebot/service/FileManagementService.java
+2
-1
applicationContext-datasource.xml
src/main/resources/applicationContext-datasource.xml
+1
-9
No files found.
src/main/java/com/bytesw/bytebot/controller/AgentController.java
View file @
8ab9c3c7
...
...
@@ -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
>
paginationCo
mmercialEquivalence
(
@RequestBody
Pagination
<
AgentBean
>
pagination
)
{
public
ResponseEntity
<
String
>
paginationCo
nversationalAgent
(
@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
>
get
ExternalSystemService
ById
(
@ApiParam
(
value
=
"id"
,
required
=
true
)
@PathVariable
(
"id"
)
Long
id
)
{
public
ResponseEntity
<
String
>
get
ConversartionalAgent
ById
(
@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
>
create
ExternalSystem
(
@RequestBody
AgentBean
agentBean
)
{
public
ResponseEntity
<
String
>
create
ConversationalAgent
(
@RequestBody
AgentBean
agentBean
)
{
HttpStatus
hs
=
HttpStatus
.
OK
;
...
...
@@ -88,7 +89,7 @@ public class AgentController {
@PostMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"hasPermission(this, 'edit')"
)
public
ResponseEntity
<
String
>
update
ExternalSystem
(
@PathVariable
(
"id"
)
Long
id
,
public
ResponseEntity
<
String
>
update
ConversationalAgent
(
@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
>
delete
ExternalSystem
(
@ApiParam
(
value
=
"id"
,
required
=
true
)
@PathVariable
(
"id"
)
Long
id
)
{
public
ResponseEntity
<
String
>
delete
ConversationalAgent
(
@ApiParam
(
value
=
"id"
,
required
=
true
)
@PathVariable
(
"id"
)
Long
id
)
{
HttpStatus
hs
=
HttpStatus
.
OK
;
try
{
...
...
src/main/java/com/bytesw/bytebot/service/AgentService.java
View file @
8ab9c3c7
...
...
@@ -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
);
...
...
src/main/java/com/bytesw/bytebot/service/FileManagementService.java
View file @
8ab9c3c7
...
...
@@ -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
();
...
...
src/main/resources/applicationContext-datasource.xml
View file @
8ab9c3c7
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment