You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dlab.apache.org by GitBox <gi...@apache.org> on 2020/02/04 00:27:37 UTC

[GitHub] [incubator-dlab] ppapou opened a new pull request #576: Dlab 1447

ppapou opened a new pull request #576: Dlab 1447
URL: https://github.com/apache/incubator-dlab/pull/576
 
 
   The endpoint name field should be verified in the first turn

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@dlab.apache.org
For additional commands, e-mail: dev-help@dlab.apache.org


[GitHub] [incubator-dlab] ppapou commented on a change in pull request #576: [DLAB-1447] Enpoints Fields verification

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@dlab.apache.org
For additional commands, e-mail: dev-help@dlab.apache.org


[GitHub] [incubator-dlab] ofuks merged pull request #576: [DLAB-1447] Enpoints Fields verification

Posted by GitBox <gi...@apache.org>.
ofuks merged pull request #576: [DLAB-1447] Enpoints Fields verification
URL: https://github.com/apache/incubator-dlab/pull/576
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@dlab.apache.org
For additional commands, e-mail: dev-help@dlab.apache.org


[GitHub] [incubator-dlab] ofuks commented on a change in pull request #576: [DLAB-1447] Enpoints Fields verification

Posted by GitBox <gi...@apache.org>.
ofuks commented on a change in pull request #576: [DLAB-1447] Enpoints Fields verification
URL: https://github.com/apache/incubator-dlab/pull/576#discussion_r374742802
 
 

 ##########
 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:
   We can use Objects.isNull() here

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@dlab.apache.org
For additional commands, e-mail: dev-help@dlab.apache.org