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
f65e07bb
Commit
f65e07bb
authored
Sep 15, 2020
by
Sebastian Chicoma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cambios y correcciones para:
Sincronización de archivos de preguntas frecuentes Gestion de agentes
parent
0631a1b3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
438 additions
and
301 deletions
+438
-301
pom.xml
pom.xml
+285
-281
FrequentQuestionBean.java
...in/java/com/bytesw/bytebot/bean/FrequentQuestionBean.java
+3
-0
CamelConfig.java
src/main/java/com/bytesw/bytebot/config/CamelConfig.java
+25
-0
AgentController.java
...n/java/com/bytesw/bytebot/controller/AgentController.java
+19
-4
FrequentQuestion.java
src/main/java/com/bytesw/bytebot/model/FrequentQuestion.java
+2
-2
FrequentQuestionRepository.java
...bytesw/bytebot/repository/FrequentQuestionRepository.java
+5
-0
QuestionFileRepository.java
...com/bytesw/bytebot/repository/QuestionFileRepository.java
+4
-0
SFTPRoute.java
src/main/java/com/bytesw/bytebot/routes/SFTPRoute.java
+28
-0
AgentService.java
src/main/java/com/bytesw/bytebot/service/AgentService.java
+49
-3
application.yml
src/main/resources/application.yml
+18
-11
No files found.
pom.xml
View file @
f65e07bb
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<parent>
<groupId>
com.bytesw.xdf
</groupId>
<groupId>
com.bytesw.xdf
</groupId>
<artifactId>
byteXDF4Java-arq
</artifactId>
<artifactId>
byteXDF4Java-arq
</artifactId>
<version>
3.1.0
</version>
<version>
3.1.0
</version>
</parent>
</parent>
<groupId>
com.bytesw.bytebot
</groupId>
<groupId>
com.bytesw.bytebot
</groupId>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
bytebot-service
</artifactId>
<artifactId>
bytebot-service
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<version>
0.0.1-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<properties>
<properties>
<xdf.version>
3.1.0
</xdf.version>
<xdf.version>
3.1.0
</xdf.version>
<camel.version>
2.22.0
</camel.version>
<docker.image.prefix>
bytesw
</docker.image.prefix>
<docker.image.prefix>
bytesw
</docker.image.prefix>
<docker.image.name>
bytebot-service
</docker.image.name>
<docker.image.name>
bytebot-service
</docker.image.name>
<packaging.type>
war
</packaging.type>
<packaging.type>
war
</packaging.type>
<json-path.version>
2.4.0
</json-path.version>
<json-path.version>
2.4.0
</json-path.version>
<org.everit.json.schema.version>
1.5.1
</org.everit.json.schema.version>
<org.everit.json.schema.version>
1.5.1
</org.everit.json.schema.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.bytesw.xdf
</groupId>
<groupId>
com.bytesw.xdf
</groupId>
<artifactId>
byteXDF4Java-coreweb
</artifactId>
<artifactId>
byteXDF4Java-coreweb
</artifactId>
<version>
${xdf.version}
</version>
<version>
${xdf.version}
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</exclusion>
</exclusion>
<exclusion>
<exclusion>
<groupId>
org.apache.tomcat.embed
</groupId>
<groupId>
org.apache.tomcat.embed
</groupId>
<artifactId>
tomcat-embed-websocket
</artifactId>
<artifactId>
tomcat-embed-websocket
</artifactId>
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.drools
</groupId>
<groupId>
org.drools
</groupId>
<artifactId>
drools-core
</artifactId>
<artifactId>
drools-core
</artifactId>
<version>
7.37.0.Final
</version>
<version>
7.37.0.Final
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<artifactId>
poi
</artifactId>
<version>
4.1.2
</version>
<version>
4.1.2
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.jayway.jsonpath
</groupId>
<groupId>
com.jayway.jsonpath
</groupId>
<artifactId>
json-path
</artifactId>
<artifactId>
json-path
</artifactId>
<version>
${json-path.version}
</version>
<version>
${json-path.version}
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.everit.json
</groupId>
<groupId>
org.everit.json
</groupId>
<artifactId>
org.everit.json.schema
</artifactId>
<artifactId>
org.everit.json.schema
</artifactId>
<version>
${org.everit.json.schema.version}
</version>
<version>
${org.everit.json.schema.version}
</version>
</dependency>
</dependency>
<!-- Inicio de Lock para scheduling -->
<!-- Inicio de Lock para scheduling -->
<dependency>
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-spring
</artifactId>
<artifactId>
shedlock-spring
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
net.javacrumbs.shedlock
</groupId>
<groupId>
net.javacrumbs.shedlock
</groupId>
<artifactId>
shedlock-provider-jdbc-template
</artifactId>
<artifactId>
shedlock-provider-jdbc-template
</artifactId>
</dependency>
</dependency>
<!-- Fin de Lock para scheduling -->
<!-- Fin de Lock para scheduling -->
<dependency>
<dependency>
<groupId>
io.micrometer
</groupId>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
<version>
1.3.2
</version>
<version>
1.3.2
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.security.oauth
</groupId>
<groupId>
org.springframework.security.oauth
</groupId>
<artifactId>
spring-security-oauth2
</artifactId>
<artifactId>
spring-security-oauth2
</artifactId>
<version>
2.3.4.RELEASE
</version>
<version>
2.3.4.RELEASE
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.security.oauth.boot
</groupId>
<groupId>
org.springframework.security.oauth.boot
</groupId>
<artifactId>
spring-security-oauth2-autoconfigure
</artifactId>
<artifactId>
spring-security-oauth2-autoconfigure
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.session
</groupId>
<groupId>
org.springframework.session
</groupId>
<artifactId>
spring-session-jdbc
</artifactId>
<artifactId>
spring-session-jdbc
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.codehaus.jettison
</groupId>
<groupId>
org.codehaus.jettison
</groupId>
<artifactId>
jettison
</artifactId>
<artifactId>
jettison
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.batch
</groupId>
<groupId>
org.springframework.batch
</groupId>
<artifactId>
spring-batch-core
</artifactId>
<artifactId>
spring-batch-core
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<artifactId>
httpclient
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
</dependency>
<!-- camel -->
<dependency>
<groupId>
org.apache.camel
</groupId>
<artifactId>
camel-ftp
</artifactId>
<version>
${camel.version}
</version>
</dependency>
<!-- test -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
net.sourceforge.cobertura
</groupId>
<artifactId>
cobertura
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.jparams
</groupId>
<artifactId>
to-string-verifier
</artifactId>
<version>
1.4.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
4.1.2
</version>
</dependency>
<!-- websocket-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
<version>
2.1.0.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
webjars-locator-core
</artifactId>
<version>
0.37
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
sockjs-client
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
stomp-websocket
</artifactId>
<version>
2.3.3
</version>
</dependency>
<!-- fin de web sockets -->
<!-- ibatis -->
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-spring
</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>
default
</id>
<activation>
<property>
<name>
default
</name>
</property>
</activation>
<properties>
<packaging.type>
jar
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.2.3
</version>
<configuration>
<warSourceExcludes>
**/jboss-web.xml
</warSourceExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>
weblogic
</id>
<activation>
<property>
<name>
weblogic
</name>
</property>
</activation>
<properties>
<packaging.type>
war
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.2.3
</version>
<configuration>
<warSourceExcludes>
**/jboss-web.xml
</warSourceExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>
nexus
</id>
<activation>
<property>
<name>
nexus
</name>
</property>
</activation>
<properties>
<packaging.type>
jar
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependencies>
</profile>
<!-- test -->
</profiles>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
net.sourceforge.cobertura
</groupId>
<artifactId>
cobertura
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.jparams
</groupId>
<artifactId>
to-string-verifier
</artifactId>
<version>
1.4.2
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
4.1.2
</version>
</dependency>
<!-- websocket-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
<version>
2.1.0.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
webjars-locator-core
</artifactId>
<version>
0.37
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
sockjs-client
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
stomp-websocket
</artifactId>
<version>
2.3.3
</version>
</dependency>
<!-- fin de web sockets -->
<!-- ibatis -->
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis
</groupId>
<artifactId>
mybatis-spring
</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>
default
</id>
<activation>
<property>
<name>
default
</name>
</property>
</activation>
<properties>
<packaging.type>
jar
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.2.3
</version>
<configuration>
<warSourceExcludes>
**/jboss-web.xml
</warSourceExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>
weblogic
</id>
<activation>
<property>
<name>
weblogic
</name>
</property>
</activation>
<properties>
<packaging.type>
war
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
3.2.3
</version>
<configuration>
<warSourceExcludes>
**/jboss-web.xml
</warSourceExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>
nexus
</id>
<activation>
<property>
<name>
nexus
</name>
</property>
</activation>
<properties>
<packaging.type>
jar
</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>
com.nimbusds
</groupId>
<artifactId>
nimbus-jose-jwt
</artifactId>
<version>
4.16
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
</project>
src/main/java/com/bytesw/bytebot/bean/FrequentQuestionBean.java
View file @
f65e07bb
...
@@ -25,6 +25,9 @@ public class FrequentQuestionBean {
...
@@ -25,6 +25,9 @@ public class FrequentQuestionBean {
@Expose
@Expose
private
Long
id
;
private
Long
id
;
@Expose
private
String
uuid
;
@Expose
@Expose
private
String
filename
;
private
String
filename
;
...
...
src/main/java/com/bytesw/bytebot/config/CamelConfig.java
0 → 100644
View file @
f65e07bb
package
com
.
bytesw
.
bytebot
.
config
;
import
com.bytesw.bytebot.routes.SFTPRoute
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.camel.CamelContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
@Configuration
@Log4j2
public
class
CamelConfig
{
@Autowired
private
CamelContext
camelContext
;
@Autowired
private
SFTPRoute
sftpRoute
;
@PostConstruct
public
void
addBuilder
()
throws
Exception
{
camelContext
.
addRoutes
(
sftpRoute
);
}
}
src/main/java/com/bytesw/bytebot/controller/AgentController.java
View file @
f65e07bb
...
@@ -11,7 +11,9 @@ import com.bytesw.xdf.sql.beans.Pagination;
...
@@ -11,7 +11,9 @@ import com.bytesw.xdf.sql.beans.Pagination;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.GsonBuilder
;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
java.util.UUID
;
import
java.util.UUID
;
import
lombok.extern.log4j.Log4j2
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.lang.exception.ExceptionUtils
;
import
org.apache.commons.lang.exception.ExceptionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -29,7 +31,7 @@ public class AgentController {
...
@@ -29,7 +31,7 @@ public class AgentController {
@Autowired
@Autowired
private
AgentService
agentService
;
private
AgentService
agentService
;
@Autowired
@Autowired
private
FileManagementService
fileManagementService
;
private
FileManagementService
fileManagementService
;
...
@@ -160,13 +162,13 @@ public class AgentController {
...
@@ -160,13 +162,13 @@ public class AgentController {
return
new
ResponseEntity
<>(
gsonBuilder
.
create
().
toJson
(
ExceptionUtils
.
getFullStackTrace
(
e
)),
hs
);
return
new
ResponseEntity
<>(
gsonBuilder
.
create
().
toJson
(
ExceptionUtils
.
getFullStackTrace
(
e
)),
hs
);
}
}
}
}
@PostMapping
(
"/file-upload"
)
@PostMapping
(
"/file-upload"
)
public
ResponseEntity
<
String
>
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
public
ResponseEntity
<
String
>
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
Gson
gson
=
new
GsonBuilder
().
create
();
Gson
gson
=
new
GsonBuilder
().
create
();
try
{
try
{
String
uuid
=
UUID
.
randomUUID
().
toString
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
FileValidationResponse
response
=
fileManagementService
.
validateAndSaveFile
(
uuid
,
file
);
FileValidationResponse
response
=
fileManagementService
.
validateAndSaveFile
(
uuid
,
file
);
return
new
ResponseEntity
<>(
gson
.
toJson
(
response
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
gson
.
toJson
(
response
),
HttpStatus
.
OK
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -174,4 +176,17 @@ public class AgentController {
...
@@ -174,4 +176,17 @@ public class AgentController {
}
}
}
}
@GetMapping
(
"/synchronize/{id}"
)
public
ResponseEntity
<
String
>
synchronizeFiles
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"user"
)
String
user
)
{
Gson
gson
=
new
GsonBuilder
().
create
();
try
{
agentService
.
synchronizeFiles
(
id
,
user
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
}
src/main/java/com/bytesw/bytebot/model/FrequentQuestion.java
View file @
f65e07bb
...
@@ -38,8 +38,8 @@ public class FrequentQuestion {
...
@@ -38,8 +38,8 @@ public class FrequentQuestion {
pkColumnValue
=
"BBOT_FREQUENT_QUESTION_SEQ"
)
pkColumnValue
=
"BBOT_FREQUENT_QUESTION_SEQ"
)
private
Long
id
;
private
Long
id
;
//@Column(name = "FQUE_PATH
")
@Column
(
name
=
"FQUE_UUID
"
)
//private String filePath
;
private
String
uuid
;
@Column
(
name
=
"FQUE_NAME"
)
@Column
(
name
=
"FQUE_NAME"
)
private
String
filename
;
private
String
filename
;
...
...
src/main/java/com/bytesw/bytebot/repository/FrequentQuestionRepository.java
View file @
f65e07bb
...
@@ -2,8 +2,11 @@ package com.bytesw.bytebot.repository;
...
@@ -2,8 +2,11 @@ package com.bytesw.bytebot.repository;
import
com.bytesw.bytebot.model.DeploymentChannel
;
import
com.bytesw.bytebot.model.DeploymentChannel
;
import
com.bytesw.bytebot.model.FrequentQuestion
;
import
com.bytesw.bytebot.model.FrequentQuestion
;
import
com.bytesw.bytebot.model.enums.FrequentQuestionStatusEnum
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.List
;
/**
/**
* @author Sebastián Chicoma Sandmann.
* @author Sebastián Chicoma Sandmann.
* @version 9-sep-2020
* @version 9-sep-2020
...
@@ -16,4 +19,6 @@ import org.springframework.data.repository.CrudRepository;
...
@@ -16,4 +19,6 @@ import org.springframework.data.repository.CrudRepository;
* licencia de uso que firmó con Byte.
* licencia de uso que firmó con Byte.
*/
*/
public
interface
FrequentQuestionRepository
extends
CrudRepository
<
FrequentQuestion
,
Long
>
{
public
interface
FrequentQuestionRepository
extends
CrudRepository
<
FrequentQuestion
,
Long
>
{
public
List
<
FrequentQuestion
>
findAllByAgentIdAndStatus
(
Long
id
,
FrequentQuestionStatusEnum
status
);
}
}
src/main/java/com/bytesw/bytebot/repository/QuestionFileRepository.java
View file @
f65e07bb
...
@@ -8,6 +8,8 @@ package com.bytesw.bytebot.repository;
...
@@ -8,6 +8,8 @@ package com.bytesw.bytebot.repository;
import
com.bytesw.bytebot.model.QuestionFile
;
import
com.bytesw.bytebot.model.QuestionFile
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.Optional
;
/**
/**
* @author Hernán Uriarte Melchor.
* @author Hernán Uriarte Melchor.
* @version 13-sep-2020
* @version 13-sep-2020
...
@@ -20,5 +22,7 @@ import org.springframework.data.repository.CrudRepository;
...
@@ -20,5 +22,7 @@ import org.springframework.data.repository.CrudRepository;
* licencia de uso que firmó con Byte.
* licencia de uso que firmó con Byte.
*/
*/
public
interface
QuestionFileRepository
extends
CrudRepository
<
QuestionFile
,
Long
>
{
public
interface
QuestionFileRepository
extends
CrudRepository
<
QuestionFile
,
Long
>
{
public
Optional
<
QuestionFile
>
findByUuid
(
String
uuid
);
}
}
src/main/java/com/bytesw/bytebot/routes/SFTPRoute.java
0 → 100644
View file @
f65e07bb
package
com
.
bytesw
.
bytebot
.
routes
;
import
org.apache.camel.builder.RouteBuilder
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
@Component
public
class
SFTPRoute
extends
RouteBuilder
{
@Value
(
"${application.bytebot-integration.ftp.username}"
)
private
String
username
;
@Value
(
"${application.bytebot-integration.ftp.password}"
)
private
String
password
;
@Value
(
"${application.bytebot-integration.ftp.directory:}"
)
private
String
directory
;
@Value
(
"${application.bytebot-integration.ftp.host}"
)
private
String
host
;
@Override
public
void
configure
()
throws
Exception
{
from
(
"direct:transferFile"
)
.
toF
(
"ftp://%s@%s/%s?password=%s&binary=true"
,
username
,
host
,
directory
,
password
)
.
log
(
"Transfered file .${file:name} "
);
}
}
src/main/java/com/bytesw/bytebot/service/AgentService.java
View file @
f65e07bb
...
@@ -6,6 +6,8 @@ import com.bytesw.bytebot.model.enums.*;
...
@@ -6,6 +6,8 @@ import com.bytesw.bytebot.model.enums.*;
import
com.bytesw.bytebot.repository.*
;
import
com.bytesw.bytebot.repository.*
;
import
com.bytesw.xdf.sql.beans.Pagination
;
import
com.bytesw.xdf.sql.beans.Pagination
;
import
lombok.extern.log4j.Log4j2
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.camel.ProducerTemplate
;
import
org.apache.commons.io.FileUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
...
@@ -16,11 +18,11 @@ import org.springframework.stereotype.Service;
...
@@ -16,11 +18,11 @@ import org.springframework.stereotype.Service;
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
java.io.File
;
import
java.io.IOException
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Optional
;
@Service
@Service
@Log4j2
@Log4j2
...
@@ -47,6 +49,12 @@ public class AgentService extends CustomPaginationService<Agent> {
...
@@ -47,6 +49,12 @@ public class AgentService extends CustomPaginationService<Agent> {
@Autowired
@Autowired
private
FrequentQuestionRepository
frequentQuestionRepository
;
private
FrequentQuestionRepository
frequentQuestionRepository
;
@Autowired
private
QuestionFileRepository
questionFileRepository
;
@Autowired
private
ProducerTemplate
producerTemplate
;
@Transactional
(
transactionManager
=
"bytebotTransactionManager"
,
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
transactionManager
=
"bytebotTransactionManager"
,
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
void
searchByPagination
(
Pagination
<
AgentBean
>
pagination
)
{
public
void
searchByPagination
(
Pagination
<
AgentBean
>
pagination
)
{
if
(
pagination
.
getItemsPerPage
()
==
0
)
{
if
(
pagination
.
getItemsPerPage
()
==
0
)
{
...
@@ -170,6 +178,7 @@ public class AgentService extends CustomPaginationService<Agent> {
...
@@ -170,6 +178,7 @@ public class AgentService extends CustomPaginationService<Agent> {
frequentQuestionBD
=
new
FrequentQuestion
();
frequentQuestionBD
=
new
FrequentQuestion
();
frequentQuestionBD
.
setStatus
(
FrequentQuestionStatusEnum
.
PENDING_SYNCHRONIZED
);
frequentQuestionBD
.
setStatus
(
FrequentQuestionStatusEnum
.
PENDING_SYNCHRONIZED
);
frequentQuestionBD
.
setUploadDate
(
LocalDateTime
.
now
());
frequentQuestionBD
.
setUploadDate
(
LocalDateTime
.
now
());
frequentQuestionBD
.
setUuid
(
frequentQuestionBean
.
getUuid
());
}
}
frequentQuestionBD
.
setAgent
(
agentBD
);
frequentQuestionBD
.
setAgent
(
agentBD
);
...
@@ -420,4 +429,41 @@ public class AgentService extends CustomPaginationService<Agent> {
...
@@ -420,4 +429,41 @@ public class AgentService extends CustomPaginationService<Agent> {
return
channelsBean
;
return
channelsBean
;
}
}
@Transactional
(
transactionManager
=
"bytebotTransactionManager"
,
propagation
=
Propagation
.
REQUIRED
)
public
void
synchronizeFiles
(
Long
id
,
String
user
)
{
List
<
FrequentQuestion
>
frequentQuestions
=
frequentQuestionRepository
.
findAllByAgentIdAndStatus
(
id
,
FrequentQuestionStatusEnum
.
PENDING_SYNCHRONIZED
);
Map
<
String
,
Object
>
headers
=
new
HashMap
<>();
for
(
FrequentQuestion
frequentQuestion
:
frequentQuestions
)
{
Optional
<
QuestionFile
>
questionFileFound
=
questionFileRepository
.
findByUuid
(
frequentQuestion
.
getUuid
());
if
(
questionFileFound
.
isPresent
())
{
headers
.
put
(
"CamelFileName"
,
questionFileFound
.
get
().
getName
());
// try {
// FileUtils.writeByteArrayToFile(new File("/home/schicoma/Escritorio/" + questionFileFound.get().getName()), questionFileFound.get().getData());
// } catch (IOException e) {
// e.printStackTrace();
// }
producerTemplate
.
sendBodyAndHeaders
(
"direct:transferFile"
,
questionFileFound
.
get
().
getData
(),
headers
);
}
frequentQuestion
.
setStatus
(
FrequentQuestionStatusEnum
.
UPLOADED
);
frequentQuestion
.
setUser
(
user
);
frequentQuestion
.
setUploadDate
(
LocalDateTime
.
now
());
frequentQuestionRepository
.
save
(
frequentQuestion
);
}
Optional
<
Agent
>
agentFound
=
agentRepository
.
findById
(
id
);
if
(
agentFound
.
isPresent
())
{
Agent
agent
=
agentFound
.
get
();
agent
.
setStatus
(
AgentStatusEnum
.
DEPLOYED
);
agentRepository
.
save
(
agent
);
}
}
}
}
src/main/resources/application.yml
View file @
f65e07bb
spring.autoconfigure.exclude
:
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration
spring.autoconfigure.exclude
:
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration
server
:
server
:
servlet.context-path
:
${APPLICATION_PATH:/
bytebot
}
servlet.context-path
:
${APPLICATION_PATH:/}
port
:
${APPLICATION_PORT:9077}
port
:
${APPLICATION_PORT:9077}
web
:
web
:
static-content-location
:
file:
e:/proyects/BYTE_BOT/bytebot-projects
/dist/bytebot-html/
static-content-location
:
file:
/home/schicoma/Documentos/Proyectos/git/BYTEBOT/bytebot-workspace
/dist/bytebot-html/
#NOTA debe terminar con /
#NOTA debe terminar con /
security
:
security
:
...
@@ -32,7 +32,7 @@ application:
...
@@ -32,7 +32,7 @@ application:
hosts
:
38F9D38DD09
hosts
:
38F9D38DD09
type
:
web
# web o service
type
:
web
# web o service
security
:
security
:
enabled
:
tru
e
enabled
:
fals
e
encryption-key
:
ENC(0WRfEFi8lYjlJj2bj37z4TRu4zmPnmXl4zM4Jpdh1H8=)*
encryption-key
:
ENC(0WRfEFi8lYjlJj2bj37z4TRu4zmPnmXl4zM4Jpdh1H8=)*
web
:
web
:
server
:
docker
# weblogic, docker
server
:
docker
# weblogic, docker
...
@@ -64,6 +64,12 @@ application:
...
@@ -64,6 +64,12 @@ application:
messaging
:
messaging
:
queue-test
:
action_queue.fifo
queue-test
:
action_queue.fifo
topic-test
:
topic-test
topic-test
:
topic-test
bytebot-integration
:
ftp
:
host
:
192.168.27.36
username
:
testuser
password
:
byte2k20
directory
:
uploadFS/IMG/
# email.info:
# email.info:
# smtp:
# smtp:
# host: smtp.gmail.com
# host: smtp.gmail.com
...
@@ -89,31 +95,32 @@ spring:
...
@@ -89,31 +95,32 @@ spring:
name
:
xdf-example
name
:
xdf-example
datasource
:
datasource
:
database-type
:
mysql
database-type
:
mysql
schemaName
:
BYTE
SGA
schemaName
:
BYTE
BOT
url
:
jdbc:mysql://localhost:
43306/BYTESGA
?useSSL=false
url
:
jdbc:mysql://localhost:
3306/BYTEBOT
?useSSL=false
driverClassName
:
'
com.mysql.cj.jdbc.Driver'
driverClassName
:
'
com.mysql.cj.jdbc.Driver'
username
:
root
username
:
root
password
:
secre
t
password
:
roo
t
minimum-idle
:
10
minimum-idle
:
10
maximum-pool-size
:
10
maximum-pool-size
:
10
validationQuery
:
SELECT 1
validationQuery
:
SELECT 1
testWhileIdle
:
true
testWhileIdle
:
true
hikari.registerMbeans
:
true
hikari.registerMbeans
:
true
security
:
security
:
basepath
:
http://
localhost:9077/piloto-xdf
basepath
:
http://
127.0.0.1:9077/
provider
:
byte
# oracle, amazon
provider
:
byte
# oracle, amazon
oauth2-client
:
oauth2-client
:
clientId
:
xdf-client
clientId
:
xdf-client
clientSecret
:
xdf-secret
clientSecret
:
xdf-secret
accessTokenUri
:
http://
192.168.1.100:8080
/oauth/token
accessTokenUri
:
http://
localhost:1102
/oauth/token
userAuthorizationUri
:
http://
192.168.1.100:8080
/oauth/authorize
userAuthorizationUri
:
http://
localhost:1102
/oauth/authorize
oauth2-resource
:
oauth2-resource
:
userInfoUri
:
http://
192.168.1.100:8080
/oauth/userinfo
userInfoUri
:
http://
localhost:1102
/oauth/userinfo
logoutUri
:
http://
192.168.1.100:8080
/oauth/userlogout
logoutUri
:
http://
localhost:1102
/oauth/userlogout
jpa
:
jpa
:
open-in-view
:
false
open-in-view
:
false
properties.hibernate
:
properties.hibernate
:
dialect
:
org.hibernate.dialect.MySQL5Dialect
dialect
:
org.hibernate.dialect.MySQL5Dialect
#dialect: org.hibernate.dialect.Oracle12cDialect
format_sql
:
false
format_sql
:
false
hbm2ddl.auto
:
none
hbm2ddl.auto
:
none
show-sql
:
true
show-sql
:
true
...
...
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