airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machristie <...@git.apache.org>
Subject [GitHub] airavata pull request #111: [AIRAVATA-2385] Checking for duplicate gateway r...
Date Wed, 07 Jun 2017 18:08:57 GMT
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 `==`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message