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
9d55bc5a
Commit
9d55bc5a
authored
Jan 04, 2022
by
Roberto Loayza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update File Deployment
parent
dc869573
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
AgentController.java
...n/java/com/bytesw/bytebot/controller/AgentController.java
+7
-4
BucketService.java
src/main/java/com/bytesw/bytebot/service/BucketService.java
+2
-2
OrquestadorService.java
...n/java/com/bytesw/bytebot/service/OrquestadorService.java
+4
-2
No files found.
src/main/java/com/bytesw/bytebot/controller/AgentController.java
View file @
9d55bc5a
...
...
@@ -11,6 +11,8 @@ import com.google.gson.GsonBuilder;
import
io.swagger.annotations.ApiParam
;
import
java.security.Principal
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.UUID
;
import
lombok.extern.log4j.Log4j2
;
...
...
@@ -195,13 +197,14 @@ public class AgentController {
@DeleteMapping
(
"/file-upload/{uuid}"
)
public
ResponseEntity
<
String
>
deleteBdc
(
@ApiParam
(
value
=
"uuid"
,
required
=
true
)
@PathVariable
(
"uuid"
)
String
uuid
)
{
Gson
gson
=
gsonBuilder
.
create
();
Map
<
String
,
String
>
resp
=
new
HashMap
<>();
try
{
orquestadorService
.
deleteBcd
(
uuid
);
String
response
=
"Todo Ok"
;
return
new
ResponseEntity
<>(
gson
.
toJson
(
resp
onse
),
HttpStatus
.
OK
);
resp
.
put
(
"message"
,
"OK"
)
;
return
new
ResponseEntity
<>(
gson
.
toJson
(
resp
),
HttpStatus
.
OK
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Error detectado: "
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
resp
.
put
(
"message"
,
"ERROR"
);
return
new
ResponseEntity
<>(
gson
.
toJson
(
resp
),
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/bytesw/bytebot/service/BucketService.java
View file @
9d55bc5a
...
...
@@ -94,14 +94,14 @@ public class BucketService {
public
void
delete
(
String
uuid
)
{
Optional
<
BusinessParameter
>
businessParameter
=
businessParameterRepository
.
findByKey
(
"Bucket"
);
if
(!
businessParameter
.
isPresent
())
{
throw
new
NotFoundException
(
"No existe el parametro de negocio del bucket."
);
throw
new
NotFoundException
();
}
String
bucketName
=
businessParameter
.
get
().
getDefaultValue
();
try
{
AmazonS3
s3Client
=
getS3Client
();
Optional
<
QuestionFile
>
questionFile
=
questionFileRepository
.
findByUuid
(
uuid
);
if
(!
questionFile
.
isPresent
())
{
throw
new
NotFoundException
(
"El uuid no se encuentra enlazado con un file"
);
throw
new
NotFoundException
();
}
String
keyName
=
String
.
format
(
"%s/%s/%s/%s/%s"
,
tenant
,
uuid
,
version
,
fileDir
,
questionFile
.
get
().
getName
());
s3Client
.
deleteObject
(
new
DeleteObjectRequest
(
bucketName
,
keyName
));
...
...
src/main/java/com/bytesw/bytebot/service/OrquestadorService.java
View file @
9d55bc5a
...
...
@@ -150,13 +150,15 @@ public class OrquestadorService {
public
void
deleteBcd
(
String
uuid
)
{
Optional
<
BdcControl
>
bdcControl
=
bdcControlRepository
.
findByUuid
(
uuid
);
if
(!
bdcControl
.
isPresent
())
{
throw
new
NotFoundException
(
"Control no encontrado."
);
//throw new NotFoundException("Control no encontrado.");
throw
new
NotFoundException
();
}
BdcControl
model
=
bdcControl
.
get
();
if
(
model
.
getStatus
().
equals
(
StatusBcdEnum
.
INDEXADO
.
getName
()))
{
boolean
step
=
knowledgeService
.
delete
(
uuid
);
if
(!
step
)
{
throw
new
NotFoundException
(
"Error a eliminar modelo del bucket"
);
//throw new NotFoundException("Error a eliminar modelo del bucket");
throw
new
NotFoundException
();
}
model
.
setStatus
(
StatusBcdEnum
.
INDEXANDO
.
getName
());
model
=
bdcControlRepository
.
save
(
model
);
...
...
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