You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2021/06/09 14:08:45 UTC
[airavata-custos] branch develop updated: restric default tenant
status to ACTIVE REQUESTED and DENIED
This is an automated email from the ASF dual-hosted git repository.
isjarana pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
The following commit(s) were added to refs/heads/develop by this push:
new 8c69a46 restric default tenant status to ACTIVE REQUESTED and DENIED
new aee46ce Merge pull request #197 from isururanawaka/event_based_messaging
8c69a46 is described below
commit 8c69a4612829d28a86acfa52c4975c81d3e2e30f
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Wed Jun 9 10:07:20 2021 -0400
restric default tenant status to ACTIVE REQUESTED and DENIED
---
.../respository/SearchTenantRepositoryImpl.java | 27 ++++++++++++++--------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/persistance/respository/SearchTenantRepositoryImpl.java b/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/persistance/respository/SearchTenantRepositoryImpl.java
index 4c7d937..08cb7df 100644
--- a/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/persistance/respository/SearchTenantRepositoryImpl.java
+++ b/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/persistance/respository/SearchTenantRepositoryImpl.java
@@ -20,6 +20,7 @@
package org.apache.custos.tenant.profile.persistance.respository;
import org.apache.custos.tenant.profile.persistance.model.Tenant;
+import org.apache.custos.tenant.profile.service.TenantStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
@@ -67,6 +68,10 @@ public class SearchTenantRepositoryImpl implements SearchTenantRepository {
query = query + "E.status LIKE :" + "status" + " AND ";
valueMap.put("status", status);
+ } else {
+ String defaultStatus = "'"+TenantStatus.REQUESTED.name()+ "'"+ "," +
+ "'"+TenantStatus.ACTIVE.name()+"'" + "," + "'"+TenantStatus.DENIED.name()+"'";
+ query = query + "E.status IN (" + defaultStatus + ") AND ";
}
if (parentId > 0) {
@@ -80,27 +85,29 @@ public class SearchTenantRepositoryImpl implements SearchTenantRepository {
valueMap.put("parent_id", 0);
}
- if ((requestEmail == null || requestEmail.isEmpty()) && (status == null || status.isEmpty()) && parentId == 0
- && (type == null || type.isEmpty()) && !type.equals("ADMIN")) {
- String directQuery = "SELECT * FROM tenant E ORDER BY E.created_at DESC";
- if (limit > 0) {
- directQuery = directQuery + " LIMIT " + ":limit" + " OFFSET " + ":offset";
- valueMap.put("limit", limit);
- valueMap.put("offset", offset);
- }
- return directQuery;
- }
+// if ((requestEmail == null || requestEmail.isEmpty()) && (status == null || status.isEmpty()) && parentId == 0
+// && (type == null || type.isEmpty()) && !type.equals("ADMIN")) {
+// String directQuery = "SELECT * FROM tenant E ORDER BY E.created_at DESC";
+// if (limit > 0) {
+// directQuery = directQuery + " LIMIT " + ":limit" + " OFFSET " + ":offset";
+// valueMap.put("limit", limit);
+// valueMap.put("offset", offset);
+// }
+// return directQuery;
+// }
query = query.substring(0, query.length() - 5);
query = query + " ORDER BY E.created_at DESC";
+
if (limit > 0) {
query = query + " LIMIT " + ":limit" + " OFFSET " + ":offset";
valueMap.put("limit", limit);
valueMap.put("offset", offset);
}
+ LOGGER.info(query);
return query;
}