[ 
https://issues.apache.org/jira/browse/AIRAVATA-2385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16041349#comment-16041349
 ] 

ASF GitHub Bot commented on AIRAVATA-2385:
------------------------------------------

Github user machristie commented on a diff in the pull request:

    https://github.com/apache/airavata/pull/111#discussion_r120702310
  
    --- Diff: 
airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
 ---
    @@ -183,12 +185,25 @@ public boolean deleteGateway(AuthzToken authzToken, 
String gatewayId) throws Ten
         public boolean isGatewayExist(AuthzToken authzToken, String gatewayId) 
throws TenantProfileServiceException, AuthorizationException, TException {
             try {
                 Gateway gateway = 
tenantProfileRepository.getGateway(gatewayId);
    -            return gateway != null;
    +            boolean checkStatus = 
gateway.getGatewayApprovalStatus().equals(GatewayApprovalStatus.APPROVED);
    +            return (gateway != null && checkStatus);
             } catch (Exception ex) {
                 logger.error("Error checking if gateway-profile exists, 
reason: " + ex.getMessage(), ex);
                 TenantProfileServiceException exception = new 
TenantProfileServiceException();
                 exception.setMessage("Error checking if gateway-profile 
exists, reason: " + ex.getMessage());
                 throw exception;
             }
         }
    +
    +    private boolean checkDuplicate(Gateway gateway) throws 
TenantProfileServiceException {
    +        try {
    +            Gateway duplicateGateway = 
tenantProfileRepository.getGateway(gateway.getGatewayId());
    +            return ((duplicateGateway.getGatewayId() == 
gateway.getGatewayId()) && (duplicateGateway.getGatewayName() == 
gateway.getGatewayName()) && (duplicateGateway.getGatewayURL() == 
gateway.getGatewayURL()) && 
(duplicateGateway.getGatewayApprovalStatus().equals(GatewayApprovalStatus.APPROVED)));
    --- End diff --
    
    Please use .equals() to compare strings instead of `==`.


> SciGaP portal need to check for duplicating gateway names and URLs at the 
> time of user creating/submitting the gateway request.
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AIRAVATA-2385
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2385
>             Project: Airavata
>          Issue Type: Improvement
>          Components: PGA PHP Web Gateway
>    Affects Versions: 0.17
>            Reporter: Eroma
>            Assignee: Sneha Tilak
>             Fix For: 0.18
>
>
> Currently wt the time of creating or submitting the request this is not 
> checked. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to