ppapou commented on a change in pull request #576: [DLAB-1447] Enpoints Fields
verification
URL: https://github.com/apache/incubator-dlab/pull/576#discussion_r374758308
##########
File path:
services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java
##########
@@ -86,20 +86,19 @@ public EndpointDTO get(String name) {
*/
@Override
public void create(UserInfo userInfo, EndpointDTO endpointDTO) {
+ if (endpointDAO.get(endpointDTO.getName()).isPresent()) {
+ throw new ResourceConflictException("The Endpoint with
this name exists in system");
+ }
if(endpointDAO.getEndpointWithUrl(endpointDTO.getUrl()).isPresent()) {
- throw new ResourceConflictException("The Endpoint URL with
this address already exists in system");
+ throw new ResourceConflictException("The Endpoint URL with
this address exists in system");
}
CloudProvider cloudProvider = checkUrl(userInfo,
endpointDTO.getUrl());
- if (!endpointDAO.get(endpointDTO.getName()).isPresent()) {
- if (!Objects.nonNull(cloudProvider)) {
- throw new DlabException("CloudProvider cannot
be null");
- }
- endpointDAO.create(new
EndpointDTO(endpointDTO.getName(), endpointDTO.getUrl(),
endpointDTO.getAccount(),
- endpointDTO.getTag(),
EndpointDTO.EndpointStatus.ACTIVE, cloudProvider));
- userRoleDao.updateMissingRoles(cloudProvider);
- } else {
- throw new ResourceConflictException("The Endpoint with
this name already exists in system");
+ if (!Objects.nonNull(cloudProvider)) {
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]