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/01/22 12:23:28 UTC

[GitHub] [incubator-dlab] ofuks commented on a change in pull request #542: [Endpoints] Verificationof the enpoint url field

ofuks commented on a change in pull request #542: [Endpoints] Verificationof the enpoint url field
URL: https://github.com/apache/incubator-dlab/pull/542#discussion_r369529185
 
 

 ##########
 File path: services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EndpointServiceImpl.java
 ##########
 @@ -68,13 +68,21 @@ public EndpointDTO get(String name) {
 				.orElseThrow(() -> new ResourceNotFoundException("Endpoint with name " + name + " not found"));
 	}
 
+	/**
+	 * Create new endpoint object in the System.
+	 * The EndPoint objects should contain Unique values of the 'url' and 'name' fields,
+	 * i.e two objects with same URLs should not be created in the system
+	 * @param userInfo user properties
+	 * @param endpointDTO object with endpoint fields
+	 */
 	@Override
 	public void create(UserInfo userInfo, EndpointDTO endpointDTO) {
+		if(endpointDAO.getEndpointWithUrl(endpointDTO.getUrl()).isPresent()) throw new ResourceConflictException("A Duplication of the Endpoint URL!");
 
 Review comment:
   We do a call to mongo [here](https://github.com/apache/incubator-dlab/pull/542/files#diff-bd755c21a7b74a54525de3eeaea2efecR82) and we already have an endpoint entity. There is no need to call mongo again

----------------------------------------------------------------
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