You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2017/05/16 15:50:32 UTC

[43/50] [abbrv] airavata git commit: Replicate gateway information if APPROVED in addGateway()

Replicate gateway information if APPROVED in addGateway()


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/940e0bae
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/940e0bae
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/940e0bae

Branch: refs/heads/registry-refactoring
Commit: 940e0baed816df7ede6f736915bf2937599d6534
Parents: e1a9ab4
Author: Gourav Shenoy <go...@apache.org>
Authored: Thu May 11 13:55:53 2017 -0400
Committer: Gourav Shenoy <go...@apache.org>
Committed: Thu May 11 13:55:53 2017 -0400

----------------------------------------------------------------------
 .../handlers/TenantProfileServiceHandler.java        | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/940e0bae/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 1327ae1..04870d9 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
@@ -74,12 +74,15 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
         try {
             gateway = tenantProfileRepository.create(gateway);
             if (gateway != null) {
-                logger.debug("Added Airavata Gateway with Id: " + gateway.getGatewayId());
-                // replicate tenant at end-places
-                ProfileServiceUtils.getDbEventPublisher().publish(
-                        ProfileServiceUtils.getDBEventMessageContext(EntityType.TENANT, CrudType.CREATE, gateway),
-                        DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString())
-                );
+                logger.info("Added Airavata Gateway with Id: " + gateway.getGatewayId());
+                // replicate tenant at end-places only if status is APPROVED
+                if (gateway.getGatewayApprovalStatus().equals(GatewayApprovalStatus.APPROVED)) {
+                    logger.info("Gateway with ID: {}, is now APPROVED, replicating to subscribers.", gateway.getGatewayId());
+                    ProfileServiceUtils.getDbEventPublisher().publish(
+                            ProfileServiceUtils.getDBEventMessageContext(EntityType.TENANT, CrudType.CREATE, gateway),
+                            DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString())
+                    );
+                }
                 // return gatewayId
                 return gateway.getGatewayId();
             } else {