Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nmaas Platform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nmaas
nmaas Platform
Commits
c60cc3bc
Commit
c60cc3bc
authored
3 weeks ago
by
Lukasz Lopatowski
Browse files
Options
Downloads
Patches
Plain Diff
Fix in webbooks retrieval
parent
7b26bc2a
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#94401
passed
3 weeks ago
Stage: test
Stage: sonar
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/geant/nmaas/portal/service/WebhookEventService.java
+10
-8
10 additions, 8 deletions
...a/net/geant/nmaas/portal/service/WebhookEventService.java
with
10 additions
and
8 deletions
src/main/java/net/geant/nmaas/portal/service/WebhookEventService.java
+
10
−
8
View file @
c60cc3bc
...
...
@@ -23,7 +23,7 @@ public class WebhookEventService {
private
static
final
String
WEBHOOK_EVENT_NOT_FOUND
=
"WebhookEvent not found."
;
@Autowired
public
WebhookEventService
(
WebhookEventRepository
webhookRepository
,
EncryptionService
encryptionService
,
ModelMapper
modelMapper
){
public
WebhookEventService
(
WebhookEventRepository
webhookRepository
,
EncryptionService
encryptionService
,
ModelMapper
modelMapper
)
{
this
.
webhookRepository
=
webhookRepository
;
this
.
encryptionService
=
encryptionService
;
this
.
modelMapper
=
modelMapper
;
...
...
@@ -50,20 +50,21 @@ public class WebhookEventService {
webhookEvent
.
setAuthorizationHeader
(
webhookEventDto
.
getAuthorizationHeader
());
}
public
void
remove
(
Long
id
){
public
void
remove
(
Long
id
)
{
WebhookEvent
webhookEvent
=
webhookRepository
.
findById
(
id
).
orElseThrow
(()
->
new
MissingElementException
(
WEBHOOK_EVENT_NOT_FOUND
));
webhookRepository
.
delete
(
webhookEvent
);
}
public
List
<
WebhookEventDto
>
getAllWebhooks
()
{
return
webhookRepository
.
findAll
().
stream
()
.
map
(
x
->
{
return
webhookRepository
.
findAll
().
stream
()
.
map
(
x
->
{
try
{
x
.
setTokenValue
(
x
.
getTokenValue
()
==
null
?
null
:
encryptionService
.
decrypt
(
x
.
getTokenValue
()));
WebhookEventDto
dto
=
modelMapper
.
map
(
x
,
WebhookEventDto
.
class
);
dto
.
setTokenValue
(
x
.
getTokenValue
()
==
null
?
null
:
encryptionService
.
decrypt
(
x
.
getTokenValue
()));
return
dto
;
}
catch
(
GeneralSecurityException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
modelMapper
.
map
(
x
,
WebhookEventDto
.
class
);
}).
toList
();
}
...
...
@@ -74,7 +75,8 @@ public class WebhookEventService {
public
WebhookEventDto
getById
(
Long
id
)
throws
GeneralSecurityException
{
WebhookEvent
event
=
webhookRepository
.
findById
(
id
)
.
orElseThrow
(()
->
new
MissingElementException
(
String
.
format
(
"WebhookEventType with id: %d cannot be found"
,
id
)));
event
.
setTokenValue
(
event
.
getTokenValue
()
==
null
?
null
:
encryptionService
.
decrypt
(
event
.
getTokenValue
()));
return
modelMapper
.
map
(
event
,
WebhookEventDto
.
class
);
WebhookEventDto
dto
=
modelMapper
.
map
(
event
,
WebhookEventDto
.
class
);
dto
.
setTokenValue
(
event
.
getTokenValue
()
==
null
?
null
:
encryptionService
.
decrypt
(
event
.
getTokenValue
()));
return
dto
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment