Skip to content
Snippets Groups Projects
Commit 2021264e authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Small update of webhooks

parent 0a13831b
Branches
Tags
1 merge request!273Release 1.8.0 update
Pipeline #95395 passed
...@@ -339,21 +339,26 @@ public class DomainServiceImpl implements DomainService { ...@@ -339,21 +339,26 @@ public class DomainServiceImpl implements DomainService {
String removedSuffix = "_DELETED_" + OffsetDateTime.now(); String removedSuffix = "_DELETED_" + OffsetDateTime.now();
return findDomain(domainId).map(domain -> { return findDomain(domainId).map(domain -> {
checkGlobal(domain); checkGlobal(domain);
final DomainView domainViewForEvent = modelMapper.map(domain, DomainView.class);
dcnRepositoryManager.removeDcnInfo(domain.getCodename()); dcnRepositoryManager.removeDcnInfo(domain.getCodename());
domain.setDeleted(true); domain.setDeleted(true);
domain.setName(domain.getName() + removedSuffix); domain.setName(domain.getName() + removedSuffix);
domain.setCodename(domain.getCodename() + removedSuffix); domain.setCodename(domain.getCodename() + removedSuffix);
Long domainDcnDetailsId = domain.getDomainDcnDetails().getId();
final Long domainDcnDetailsId = domain.getDomainDcnDetails().getId();
domain.setDomainDcnDetails(null); domain.setDomainDcnDetails(null);
domainDcnDetailsRepository.deleteById(domainDcnDetailsId); domainDcnDetailsRepository.deleteById(domainDcnDetailsId);
Long domainTechDetailsId = domain.getDomainTechDetails().getId();
final Long domainTechDetailsId = domain.getDomainTechDetails().getId();
domain.setDomainTechDetails(null); domain.setDomainTechDetails(null);
domainTechDetailsRepository.deleteById(domainTechDetailsId); domainTechDetailsRepository.deleteById(domainTechDetailsId);
removeAllUsersFromDomain(domain); removeAllUsersFromDomain(domain);
removeDomainFromAllGroups(domain); removeDomainFromAllGroups(domain);
domainRepository.save(domain); domainRepository.save(domain);
DomainView domainView = modelMapper.map(domain, DomainView.class);
eventPublisher.publishEvent(new DomainRemovalEvent(this, domainView, true)); eventPublisher.publishEvent(new DomainRemovalEvent(this, domainViewForEvent, true));
return true; return true;
}).orElse(false); }).orElse(false);
} }
......
...@@ -55,14 +55,15 @@ public class WebhooksEventListener { ...@@ -55,14 +55,15 @@ public class WebhooksEventListener {
@Loggable(LogLevel.INFO) @Loggable(LogLevel.INFO)
@Transactional @Transactional
public void trigger(DomainRemovalEvent event) { public void trigger(DomainRemovalEvent event) {
final DomainView domainView = event.getDomainView(); final DomainView domain = event.getDomainView();
domain.setClusters(Collections.emptyList());
String action = event.isHardRemoval() ? "delete" : "softDelete"; String action = event.isHardRemoval() ? "delete" : "softDelete";
webhookEventRepository.findIdByEventType(WebhookEventType.DOMAIN_ACTION) webhookEventRepository.findIdByEventType(WebhookEventType.DOMAIN_ACTION)
.forEach(id -> .forEach(id ->
scheduleManager.createOneTimeJob( scheduleManager.createOneTimeJob(
DomainActionJob.class, DomainActionJob.class,
"Domain" + action + "_" + id + "_" + domainView.getId(), "Domain" + action + "_" + id + "_" + domain.getId(),
Map.of("webhookId", id, "domain", domainView, "action", action)) Map.of("webhookId", id, "domain", domain, "action", action))
); );
} }
......
...@@ -1359,10 +1359,10 @@ ...@@ -1359,10 +1359,10 @@
"TYPE" : "Webhook type", "TYPE" : "Webhook type",
"TOKEN" : "Token value", "TOKEN" : "Token value",
"AUTH" : "Authorization header", "AUTH" : "Authorization header",
"DOMAIN_CREATION" : "Domain creation", "DOMAIN_ACTION" : "Domain action",
"DOMAIN_GROUP_ACTION" : "Domain group action",
"APPLICATION_DEPLOYMENT" : "Application deployment", "APPLICATION_DEPLOYMENT" : "Application deployment",
"USER_ASSIGNMENT" : "User assignment", "USER_ASSIGNMENT" : "User assignment",
"DOMAIN_GROUP_CHANGE" : "Domain group change",
"NEW" : "Add webhook", "NEW" : "Add webhook",
"DETAILS" : "Webhooks details", "DETAILS" : "Webhooks details",
"SAVE" : "Save", "SAVE" : "Save",
......
...@@ -1364,10 +1364,10 @@ ...@@ -1364,10 +1364,10 @@
"TYPE" : "Webhook type", "TYPE" : "Webhook type",
"TOKEN" : "Token value", "TOKEN" : "Token value",
"AUTH" : "Authorization header", "AUTH" : "Authorization header",
"DOMAIN_CREATION" : "Domain creation", "DOMAIN_ACTION" : "Domain action",
"DOMAIN_GROUP_ACTION" : "Domain group action",
"APPLICATION_DEPLOYMENT" : "Application deployment", "APPLICATION_DEPLOYMENT" : "Application deployment",
"USER_ASSIGNMENT" : "User assignment", "USER_ASSIGNMENT" : "User assignment",
"DOMAIN_GROUP_CHANGE" : "Domain group change",
"NEW" : "Add webhook", "NEW" : "Add webhook",
"DETAILS" : "Webhooks details", "DETAILS" : "Webhooks details",
"SAVE" : "Save", "SAVE" : "Save",
......
...@@ -1363,10 +1363,10 @@ ...@@ -1363,10 +1363,10 @@
"TYPE" : "Webhook type", "TYPE" : "Webhook type",
"TOKEN" : "Token value", "TOKEN" : "Token value",
"AUTH" : "Authorization header", "AUTH" : "Authorization header",
"DOMAIN_CREATION" : "Domain creation", "DOMAIN_ACTION" : "Domain action",
"DOMAIN_GROUP_ACTION" : "Domain group action",
"APPLICATION_DEPLOYMENT" : "Application deployment", "APPLICATION_DEPLOYMENT" : "Application deployment",
"USER_ASSIGNMENT" : "User assignment", "USER_ASSIGNMENT" : "User assignment",
"DOMAIN_GROUP_CHANGE" : "Domain group change",
"NEW" : "Add webhook", "NEW" : "Add webhook",
"DETAILS" : "Webhooks details", "DETAILS" : "Webhooks details",
"SAVE" : "Save", "SAVE" : "Save",
......
...@@ -1362,10 +1362,10 @@ ...@@ -1362,10 +1362,10 @@
"TYPE" : "Webhook type", "TYPE" : "Webhook type",
"TOKEN" : "Token value", "TOKEN" : "Token value",
"AUTH" : "Authorization header", "AUTH" : "Authorization header",
"DOMAIN_CREATION" : "Domain creation", "DOMAIN_ACTION" : "Domain action",
"DOMAIN_GROUP_ACTION" : "Domain group action",
"APPLICATION_DEPLOYMENT" : "Application deployment", "APPLICATION_DEPLOYMENT" : "Application deployment",
"USER_ASSIGNMENT" : "User assignment", "USER_ASSIGNMENT" : "User assignment",
"DOMAIN_GROUP_CHANGE" : "Domain group change",
"NEW" : "Add webhook", "NEW" : "Add webhook",
"DETAILS" : "Webhooks details", "DETAILS" : "Webhooks details",
"SAVE" : "Save", "SAVE" : "Save",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment