airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From goshe...@apache.org
Subject [4/5] airavata git commit: Modified TenantProfileRepository.java to pass paramenters to the query
Date Mon, 12 Jun 2017 18:52:27 GMT
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 <tilaks@149-160-244-249.dhcp-bl.indiana.edu>
Authored: Fri Jun 9 15:17:07 2017 -0400
Committer: Sneha Tilak <tilaks@149-160-244-249.dhcp-bl.indiana.edu>
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<Gateway> 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<Gateway,
Gateway
         try {
             Map<String, Object> queryParam = new HashMap<String, Object>();
             queryParam.put(Gateway._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+            queryParam.put(Gateway._Fields.GATEWAY_APPROVAL_STATUS.getFieldName(), GatewayApprovalStatus.APPROVED.name());
             List<Gateway> 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<Gateway,
Gateway
         }
     }
 
-    public List<Gateway> getAllGatewaysForUser () throws Exception {
+    public List<Gateway> getAllGatewaysForUser (String requesterUsername) throws Exception
{
         try {
-            List<Gateway> gatewayList = select(QueryConstants.GET_USER_GATEWAYS);
+            Map<String, Object> queryParam = new HashMap<String, Object>();
+            queryParam.put(Gateway._Fields.REQUESTER_USERNAME.getFieldName(), requesterUsername);
+            List<Gateway> 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);


Mime
View raw message