This is an automated email from the ASF dual-hosted git repository. ofuks pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push: new 8163664 [DLAB-1406] Added validation for endpoint disconnection in case if saving related resources 8163664 is described below commit 8163664c96f09205d5917706a7fa0335b9a95dca Author: Oleh Fuks <olegfuk...@gmail.com> AuthorDate: Wed Dec 18 16:23:16 2019 +0200 [DLAB-1406] Added validation for endpoint disconnection in case if saving related resources --- .../java/com/epam/dlab/backendapi/service/EndpointService.java | 3 ++- .../epam/dlab/backendapi/service/impl/EndpointServiceImpl.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EndpointService.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EndpointService.java index 4f5d6b1..9e26da7 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EndpointService.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/EndpointService.java @@ -3,6 +3,7 @@ package com.epam.dlab.backendapi.service; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.domain.EndpointDTO; import com.epam.dlab.backendapi.domain.EndpointResourcesDTO; +import com.epam.dlab.backendapi.domain.ProjectDTO; import java.util.List; @@ -17,5 +18,5 @@ public interface EndpointService { void remove(UserInfo userInfo, String name, boolean withResources); - void removeEndpointInAllProjects(UserInfo userInfo, String endpointName); + void removeEndpointInAllProjects(UserInfo userInfo, String endpointName, List<ProjectDTO> projects); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java index 16f2154..adb9c86 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java @@ -62,17 +62,17 @@ public class EndpointServiceImpl implements EndpointService { @Override public void remove(UserInfo userInfo, String name, boolean withResources) { + List<ProjectDTO> projects = projectService.getProjectsByEndpoint(name); + checkProjectEndpointResourcesStatuses(projects, name); + if (withResources) { - removeEndpointInAllProjects(userInfo, name); + removeEndpointInAllProjects(userInfo, name, projects); } endpointDAO.remove(name); } @Override - public void removeEndpointInAllProjects(UserInfo userInfo, String endpointName) { - List<ProjectDTO> projects = projectService.getProjectsByEndpoint(endpointName); - checkProjectEndpointResourcesStatuses(projects, endpointName); - + public void removeEndpointInAllProjects(UserInfo userInfo, String endpointName, List<ProjectDTO> projects) { projects.forEach(project -> projectService.terminateEndpoint(userInfo, endpointName, project.getName())); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org