From commits-return-17258-apmail-airavata-commits-archive=airavata.apache.org@airavata.apache.org Mon Jun 12 18:52:27 2017 Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C2D819F2A for ; Mon, 12 Jun 2017 18:52:27 +0000 (UTC) Received: (qmail 84188 invoked by uid 500); 12 Jun 2017 18:52:27 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 84119 invoked by uid 500); 12 Jun 2017 18:52:27 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 84038 invoked by uid 99); 12 Jun 2017 18:52:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2017 18:52:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E758BE8EFD; Mon, 12 Jun 2017 18:52:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: goshenoy@apache.org To: commits@airavata.apache.org Date: Mon, 12 Jun 2017 18:52:27 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/5] airavata git commit: Modified TenantProfileRepository.java to pass paramenters to the query Modified TenantProfileRepository.java to pass paramenters to the query Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b3e07540 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b3e07540 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b3e07540 Branch: refs/heads/develop Commit: b3e07540f665e4d419c246076cf504dc4f1f348e Parents: 29718e0 Author: Sneha Tilak Authored: Fri Jun 9 15:17:07 2017 -0400 Committer: Sneha Tilak Committed: Fri Jun 9 15:17:07 2017 -0400 ---------------------------------------------------------------------- .../service/profile/commons/utils/QueryConstants.java | 2 +- .../profile/handlers/TenantProfileServiceHandler.java | 2 +- .../tenant/core/repositories/TenantProfileRepository.java | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/b3e07540/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/QueryConstants.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/QueryConstants.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/QueryConstants.java index d63957f..b440ecc 100644 --- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/QueryConstants.java +++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/QueryConstants.java @@ -23,5 +23,5 @@ public class QueryConstants { public static final String GET_ALL_GATEWAYS = "SELECT g FROM GatewayEntity g"; public static final String GET_USER_GATEWAYS = "SELECT g from GatewayEntity g" + - "where g.requesterUsername LIKE :" +Gateway._Fields.REQUESTER_USERNAME.getFieldName() + ""; + "where g.requesterUsername LIKE :" + Gateway._Fields.REQUESTER_USERNAME.getFieldName() + ""; } http://git-wip-us.apache.org/repos/asf/airavata/blob/b3e07540/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java index b7f3d22..94c5181 100644 --- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java +++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java @@ -200,7 +200,7 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface { @SecurityCheck public List getAllGatewaysForUser(AuthzToken authzToken, String requesterUsername) throws TenantProfileServiceException, AuthorizationException, TException { try { - return tenantProfileRepository.getAllGatewaysForUser(); + return tenantProfileRepository.getAllGatewaysForUser(requesterUsername); } catch (Exception ex) { logger.error("Error getting user's gateway-profiles, reason: " + ex.getMessage(), ex); TenantProfileServiceException exception = new TenantProfileServiceException(); http://git-wip-us.apache.org/repos/asf/airavata/blob/b3e07540/airavata-services/profile-service/profile-tenant-core/src/main/java/org/apache/airavata/service/profile/tenant/core/repositories/TenantProfileRepository.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-tenant-core/src/main/java/org/apache/airavata/service/profile/tenant/core/repositories/TenantProfileRepository.java b/airavata-services/profile-service/profile-tenant-core/src/main/java/org/apache/airavata/service/profile/tenant/core/repositories/TenantProfileRepository.java index d8df354..ad38cf7 100644 --- a/airavata-services/profile-service/profile-tenant-core/src/main/java/org/apache/airavata/service/profile/tenant/core/repositories/TenantProfileRepository.java +++ b/airavata-services/profile-service/profile-tenant-core/src/main/java/org/apache/airavata/service/profile/tenant/core/repositories/TenantProfileRepository.java @@ -21,6 +21,7 @@ package org.apache.airavata.service.profile.tenant.core.repositories; import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.model.workspace.GatewayApprovalStatus; import org.apache.airavata.service.profile.commons.repositories.AbstractRepository; import org.apache.airavata.service.profile.commons.tenant.entities.GatewayEntity; import org.apache.airavata.service.profile.commons.utils.QueryConstants; @@ -48,6 +49,7 @@ public class TenantProfileRepository extends AbstractRepository queryParam = new HashMap(); queryParam.put(Gateway._Fields.GATEWAY_ID.getFieldName(), gatewayId); + queryParam.put(Gateway._Fields.GATEWAY_APPROVAL_STATUS.getFieldName(), GatewayApprovalStatus.APPROVED.name()); List gatewayList = select(QueryConstants.FIND_GATEWAY_BY_ID, 1, 0, queryParam); if (!gatewayList.isEmpty()) { gateway = gatewayList.get(0); @@ -69,9 +71,11 @@ public class TenantProfileRepository extends AbstractRepository getAllGatewaysForUser () throws Exception { + public List getAllGatewaysForUser (String requesterUsername) throws Exception { try { - List gatewayList = select(QueryConstants.GET_USER_GATEWAYS); + Map queryParam = new HashMap(); + queryParam.put(Gateway._Fields.REQUESTER_USERNAME.getFieldName(), requesterUsername); + List gatewayList = select(QueryConstants.GET_USER_GATEWAYS, 1, 0, queryParam); return gatewayList; } catch (Exception e){ logger.error("Error while getting the user's gateways, reason: ", e);