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/23 14:47:11 UTC

[GitHub] [incubator-dlab] ppapou commented on a change in pull request #542: [DLAB-1447] Verification of the enpoint url field

ppapou commented on a change in pull request #542: [DLAB-1447] Verification of the enpoint url field
URL: https://github.com/apache/incubator-dlab/pull/542#discussion_r370160100
 
 

 ##########
 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:
   The Exception has been thrown in the 'if' instruction.
   The error messages has been updated according requirements

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