You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/11 12:59:58 UTC

[airavata] 02/02: Using getters instead of direct member access

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 6c41f4fbaa349d05aba4e249c2ca5d8ef3250407
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Jun 11 08:59:32 2019 -0400

    Using getters instead of direct member access
---
 .../api/server/handler/AiravataServerHandler.java  |  34 +++---
 .../service/security/GatewayGroupsInitializer.java |   6 +-
 .../migrator/airavata/AiravataDataMigrator.java    | 116 ++++++++++-----------
 .../messaging/SharingServiceDBEventHandler.java    |  18 ++--
 .../server/SharingRegistryServerHandler.java       |  20 ++--
 5 files changed, 100 insertions(+), 94 deletions(-)

diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 115061a..7ca4346 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -235,22 +235,22 @@ public class AiravataServerHandler implements Airavata.Iface {
                 client.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.APPLICATION_DEPLOYMENT.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.APPLICATION_DEPLOYMENT.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName("APPLICATION-DEPLOYMENT");
                 entityType.setDescription("Application Deployment entity type");
                 client.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
                 entityType.setDescription("Group Resource Profile entity type");
                 client.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.CREDENTIAL_TOKEN.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.CREDENTIAL_TOKEN.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
                 entityType.setDescription("Credential Store Token entity type");
                 client.createEntityType(entityType);
@@ -348,15 +348,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             sharingClient.createEntityType(entityType);
 
             entityType = new EntityType();
-            entityType.setEntityTypeId(domain.domainId+":"+ResourceType.APPLICATION_DEPLOYMENT.name());
-            entityType.setDomainId(domain.domainId);
+            entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.APPLICATION_DEPLOYMENT.name());
+            entityType.setDomainId(domain.getDomainId());
             entityType.setName("APPLICATION-DEPLOYMENT");
             entityType.setDescription("Application Deployment entity type");
             sharingClient.createEntityType(entityType);
 
             entityType = new EntityType();
-            entityType.setEntityTypeId(domain.domainId+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
-            entityType.setDomainId(domain.domainId);
+            entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
+            entityType.setDomainId(domain.getDomainId());
             entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
             entityType.setDescription("Group Resource Profile entity type");
             sharingClient.createEntityType(entityType);
@@ -768,7 +768,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             filters.add(searchCriteria);
             List<String> accessibleTokenIds = sharingClient.searchEntities(gatewayId, userName + "@" + gatewayId, filters, 0, -1)
                     .stream()
-                    .map(p -> p.entityId)
+                    .map(p -> p.getEntityId())
                     .collect(Collectors.toList());
             List<CredentialSummary> credentialSummaries = csClient.getAllCredentialSummaries(type, accessibleTokenIds, gatewayId);
             csClientPool.returnResource(csClient);
@@ -2329,7 +2329,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
                 sharingFilters.add(permissionTypeFilter);
                 sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
-                        userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(a -> accessibleAppDeploymentIds.add(a.entityId));
+                        userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(a -> accessibleAppDeploymentIds.add(a.getEntityId()));
             }
             List<String> accessibleComputeResourceIds = new ArrayList<>();
             List<GroupResourceProfile> groupResourceProfileList = getGroupResourceList(authzToken, gatewayId);
@@ -2569,7 +2569,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 permissionTypeFilter.setValue(gatewayId + ":" + permissionType.name());
                 sharingFilters.add(permissionTypeFilter);
                 sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
-                        userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(a -> accessibleAppDeploymentIds.add(a.entityId));
+                        userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(a -> accessibleAppDeploymentIds.add(a.getEntityId()));
             }
             List<String> accessibleComputeResourceIds = new ArrayList<>();
             List<GroupResourceProfile> groupResourceProfileList = getGroupResourceList(authzToken, gatewayId);
@@ -2669,7 +2669,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
             sharingFilters.add(permissionTypeFilter);
             sharingClient.searchEntities(gatewayId, userName + "@" + gatewayId, sharingFilters, 0, -1)
-                    .forEach(a -> accessibleAppDeploymentIds.add(a.entityId));
+                    .forEach(a -> accessibleAppDeploymentIds.add(a.getEntityId()));
 
             List<ApplicationDeploymentDescription> result = regClient.getAccessibleApplicationDeploymentsForAppModule(
                     gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
@@ -5266,11 +5266,11 @@ public class AiravataServerHandler implements Airavata.Iface {
             if (permissionType.equals(ResourcePermissionType.WRITE)) {
                 groupListFunction.apply(sharingClient, ResourcePermissionType.WRITE)
                         .stream()
-                        .forEach(g -> accessibleGroups.add(g.groupId));
+                        .forEach(g -> accessibleGroups.add(g.getGroupId()));
             } else if (permissionType.equals(ResourcePermissionType.READ)) {
                 groupListFunction.apply(sharingClient, ResourcePermissionType.READ)
                         .stream()
-                        .forEach(g -> accessibleGroups.add(g.groupId));
+                        .forEach(g -> accessibleGroups.add(g.getGroupId()));
             }
             registryClientPool.returnResource(regClient);
             sharingClientPool.returnResource(sharingClient);
@@ -5490,7 +5490,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 filters.add(searchCriteria);
                 sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                         userName + "@" + gatewayId, filters, 0, -1).stream().forEach(p -> accessibleGroupResProfileIds
-                        .add(p.entityId));
+                        .add(p.getEntityId()));
 
             }
             List<GroupResourceProfile> groupResourceProfileList = regClient.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
diff --git a/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java b/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
index c51d67a..fcc1ae5 100644
--- a/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
+++ b/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
@@ -98,17 +98,17 @@ public class GatewayGroupsInitializer {
         UserGroup gatewayUsersGroup = createGroup(sharingRegistryClient, gatewayId, ownerId,
                 "Gateway Users",
                 "Default group for users of the gateway.");
-        gatewayGroups.setDefaultGatewayUsersGroupId(gatewayUsersGroup.groupId);
+        gatewayGroups.setDefaultGatewayUsersGroupId(gatewayUsersGroup.getGroupId());
         // Admin Users
         UserGroup adminUsersGroup = createGroup(sharingRegistryClient, gatewayId, ownerId,
                 "Admin Users",
                 "Admin users group.");
-        gatewayGroups.setAdminsGroupId(adminUsersGroup.groupId);
+        gatewayGroups.setAdminsGroupId(adminUsersGroup.getGroupId());
         // Read Only Admin Users
         UserGroup readOnlyAdminsGroup = createGroup(sharingRegistryClient, gatewayId, ownerId,
                 "Read Only Admin Users",
                 "Group of admin users with read-only access.");
-        gatewayGroups.setReadOnlyAdminsGroupId(readOnlyAdminsGroup.groupId);
+        gatewayGroups.setReadOnlyAdminsGroupId(readOnlyAdminsGroup.getGroupId());
 
         registryClient.createGatewayGroups(gatewayGroups);
 
diff --git a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
index cd6b91f..57caba2 100644
--- a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
+++ b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
@@ -114,27 +114,27 @@ public class AiravataDataMigrator {
                     sharingRegistryServerHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ ResourceType.APPLICATION_DEPLOYMENT.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ ResourceType.APPLICATION_DEPLOYMENT.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName("APPLICATION-DEPLOYMENT");
                 entityType.setDescription("Application Deployment entity type");
-                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.domainId, entityType.entityTypeId))
+                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.getDomainId(), entityType.getEntityTypeId()))
                     sharingRegistryServerHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
                 entityType.setDescription("Group Resource Profile entity type");
-                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.domainId, entityType.entityTypeId))
+                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.getDomainId(), entityType.getEntityTypeId()))
                     sharingRegistryServerHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
-                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.CREDENTIAL_TOKEN.name());
-                entityType.setDomainId(domain.domainId);
+                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.CREDENTIAL_TOKEN.name());
+                entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
                 entityType.setDescription("Credential Store Token entity type");
-                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.domainId, entityType.entityTypeId))
+                if (!sharingRegistryServerHandler.isEntityTypeExists(entityType.getDomainId(), entityType.getEntityTypeId()))
                     sharingRegistryServerHandler.createEntityType(entityType);
 
                 //Creating Permission Types for each domain
@@ -187,23 +187,23 @@ public class AiravataDataMigrator {
         final RegistryService.Client registryServiceClient = getRegistryServiceClient();
         for (Domain domain : domainList) {
             // If we're only running migration for gatewayId, then skip other gateways
-            if (gatewayId != null && !gatewayId.equals(domain.domainId)) {
+            if (gatewayId != null && !gatewayId.equals(domain.getDomainId())) {
                 continue;
             }
             String ownerId = getAdminOwnerUser(domain, sharingRegistryServerHandler, credentialStoreServiceClient, registryServiceClient);
             if (ownerId != null) {
-                domainOwnerMap.put(domain.domainId, ownerId);
+                domainOwnerMap.put(domain.getDomainId(), ownerId);
             } else {
                 continue;
             }
 
-            if (registryServiceClient.isGatewayGroupsExists(domain.domainId)) {
-                GatewayGroups gatewayGroups = registryServiceClient.getGatewayGroups(domain.domainId);
-                gatewayGroupsMap.put(domain.domainId, gatewayGroups);
+            if (registryServiceClient.isGatewayGroupsExists(domain.getDomainId())) {
+                GatewayGroups gatewayGroups = registryServiceClient.getGatewayGroups(domain.getDomainId());
+                gatewayGroupsMap.put(domain.getDomainId(), gatewayGroups);
             } else {
 
                 GatewayGroups gatewayGroups = migrateRolesToGatewayGroups(domain, ownerId, sharingRegistryServerHandler, registryServiceClient);
-                gatewayGroupsMap.put(domain.domainId, gatewayGroups);
+                gatewayGroupsMap.put(domain.getDomainId(), gatewayGroups);
             }
         }
 
@@ -268,24 +268,24 @@ public class AiravataDataMigrator {
         }
 
         for (Entity entity : projectEntities) {
-            if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId)) {
+            if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId())) {
                 sharingRegistryServerHandler.createEntity(entity);
             }
         }
 
         for (Entity entity : experimentEntities) {
-            if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId)) {
-                if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.parentEntityId)) {
-                    System.out.println("Warning: project entity does exist for experiment entity " + entity.entityId + " in gateway " + entity.domainId);
+            if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId())) {
+                if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getParentEntityId())) {
+                    System.out.println("Warning: project entity does exist for experiment entity " + entity.getEntityId() + " in gateway " + entity.getDomainId());
                     continue;
                 } else {
                     sharingRegistryServerHandler.createEntity(entity);
                 }
             }
-            if (gatewayGroupsMap.containsKey(entity.domainId)) {
-                shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.domainId), false);
+            if (gatewayGroupsMap.containsKey(entity.getDomainId())) {
+                shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.getDomainId()), false);
             } else {
-                System.out.println("Warning: no Admin gateway groups to share experiment entity " + entity.entityId + " in gateway " + entity.domainId);
+                System.out.println("Warning: no Admin gateway groups to share experiment entity " + entity.getEntityId() + " in gateway " + entity.getDomainId());
             }
         }
 
@@ -297,7 +297,7 @@ public class AiravataDataMigrator {
                 Entity entity = new Entity();
                 entity.setEntityId(description.getAppDeploymentId());
                 entity.setDomainId(domainID);
-                entity.setEntityTypeId(entity.domainId + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
+                entity.setEntityTypeId(entity.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
                 entity.setOwnerId(domainOwnerMap.get(domainID));
                 entity.setName(description.getAppDeploymentId());
                 entity.setDescription(description.getAppDeploymentDescription());
@@ -306,7 +306,7 @@ public class AiravataDataMigrator {
                 else
                     entity.setFullText(entity.getName() + " " + entity.getDescription());
 
-                if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+                if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
                     sharingRegistryServerHandler.createEntity(entity);
                 shareEntityWithGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroups, false);
             }
@@ -323,11 +323,11 @@ public class AiravataDataMigrator {
                 Entity entity = new Entity();
                 entity.setEntityId(groupResourceProfile.getGroupResourceProfileId());
                 entity.setDomainId(domainID);
-                entity.setEntityTypeId(entity.domainId + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
+                entity.setEntityTypeId(entity.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
                 entity.setOwnerId(domainOwnerMap.get(domainID));
                 entity.setName(groupResourceProfile.getGroupResourceProfileName());
                 entity.setDescription(groupResourceProfile.getGroupResourceProfileName() + " Group Resource Profile");
-                if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+                if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
                     sharingRegistryServerHandler.createEntity(entity);
                 shareEntityWithGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroups, false);
 
@@ -341,14 +341,14 @@ public class AiravataDataMigrator {
                 Entity entity = new Entity();
                 entity.setEntityId(credentialSummary.getToken());
                 entity.setDomainId(domainID);
-                entity.setEntityTypeId(entity.domainId + ":" + ResourceType.CREDENTIAL_TOKEN.name());
+                entity.setEntityTypeId(entity.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
                 entity.setOwnerId(domainOwnerMap.get(domainID));
                 entity.setName(credentialSummary.getToken());
                 entity.setDescription(credentialSummary.getDescription());
-                if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+                if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
                     sharingRegistryServerHandler.createEntity(entity);
-                if (gatewayGroupsMap.containsKey(entity.domainId)) {
-                    shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.domainId), false);
+                if (gatewayGroupsMap.containsKey(entity.getDomainId())) {
+                    shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.getDomainId()), false);
                 }
             }
         }
@@ -370,11 +370,11 @@ public class AiravataDataMigrator {
                     Entity entity = new Entity();
                     entity.setEntityId(credentialSummary.getToken());
                     entity.setDomainId(domainID);
-                    entity.setEntityTypeId(entity.domainId + ":" + ResourceType.CREDENTIAL_TOKEN.name());
+                    entity.setEntityTypeId(entity.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
                     entity.setOwnerId(userId);
                     entity.setName(credentialSummary.getToken());
                     entity.setDescription(credentialSummary.getDescription());
-                    if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+                    if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
                         sharingRegistryServerHandler.createEntity(entity);
                     // Don't need to share USER SSH tokens with any group
                 }
@@ -387,14 +387,14 @@ public class AiravataDataMigrator {
                 Entity entity = new Entity();
                 entity.setEntityId(gatewayPasswordEntry.getKey());
                 entity.setDomainId(domainID);
-                entity.setEntityTypeId(entity.domainId + ":" + ResourceType.CREDENTIAL_TOKEN.name());
+                entity.setEntityTypeId(entity.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
                 entity.setOwnerId(domainOwnerMap.get(domainID));
                 entity.setName(gatewayPasswordEntry.getKey());
                 entity.setDescription(gatewayPasswordEntry.getValue());
-                if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+                if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
                     sharingRegistryServerHandler.createEntity(entity);
-                if (gatewayGroupsMap.containsKey(entity.domainId)) {
-                    shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.domainId), false);
+                if (gatewayGroupsMap.containsKey(entity.getDomainId())) {
+                    shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroupsMap.get(entity.getDomainId()), false);
                 }
             }
         }
@@ -407,53 +407,53 @@ public class AiravataDataMigrator {
 
     private static void shareEntityWithGatewayGroups(SharingRegistryServerHandler sharingRegistryServerHandler, Entity entity, GatewayGroups gatewayGroups, boolean cascadePermission) throws TException {
         // Give default Gateway Users group READ access
-        sharingRegistryServerHandler.shareEntityWithGroups(entity.domainId, entity.entityId,
+        sharingRegistryServerHandler.shareEntityWithGroups(entity.getDomainId(), entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getDefaultGatewayUsersGroupId()),
-                entity.domainId + ":" + ResourcePermissionType.READ, cascadePermission);
+                entity.getDomainId() + ":" + ResourcePermissionType.READ, cascadePermission);
         shareEntityWithAdminGatewayGroups(sharingRegistryServerHandler, entity, gatewayGroups, cascadePermission);
     }
 
     private static void shareEntityWithAdminGatewayGroups(SharingRegistryServerHandler sharingRegistryServerHandler, Entity entity, GatewayGroups gatewayGroups, boolean cascadePermission) throws TException {
         // Give Admins group and Read Only Admins group READ access
-        sharingRegistryServerHandler.shareEntityWithGroups(entity.domainId, entity.entityId,
+        sharingRegistryServerHandler.shareEntityWithGroups(entity.getDomainId(), entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getAdminsGroupId(), gatewayGroups.getReadOnlyAdminsGroupId()),
-                entity.domainId + ":" + ResourcePermissionType.READ, cascadePermission);
+                entity.getDomainId() + ":" + ResourcePermissionType.READ, cascadePermission);
         // Give Admins group WRITE access
-        sharingRegistryServerHandler.shareEntityWithGroups(entity.domainId, entity.entityId,
+        sharingRegistryServerHandler.shareEntityWithGroups(entity.getDomainId(), entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getAdminsGroupId()),
-                entity.domainId + ":" + ResourcePermissionType.WRITE, cascadePermission);
+                entity.getDomainId() + ":" + ResourcePermissionType.WRITE, cascadePermission);
     }
 
     private static GatewayGroups migrateRolesToGatewayGroups(Domain domain, String ownerId, SharingRegistryServerHandler sharingRegistryServerHandler, RegistryService.Client registryServiceClient) throws TException, ApplicationSettingsException {
         GatewayGroups gatewayGroups = new GatewayGroups();
-        gatewayGroups.setGatewayId(domain.domainId);
+        gatewayGroups.setGatewayId(domain.getDomainId());
 
         // Migrate roles to groups
-        List<String> usernames = sharingRegistryServerHandler.getUsers(domain.domainId, 0, -1)
+        List<String> usernames = sharingRegistryServerHandler.getUsers(domain.getDomainId(), 0, -1)
                 .stream()
                 // Filter out bad ids that don't have an "@" in them
                 .filter(user -> user.getUserId().lastIndexOf("@") > 0)
                 .map(user -> user.getUserId().substring(0, user.getUserId().lastIndexOf("@")))
                 .collect(Collectors.toList());
-        Map<String, List<String>> roleMap = loadRolesForUsers(domain.domainId, usernames);
+        Map<String, List<String>> roleMap = loadRolesForUsers(domain.getDomainId(), usernames);
 
         UserGroup gatewayUsersGroup = createGroup(sharingRegistryServerHandler, domain, ownerId,
                 "Gateway Users",
                 "Default group for users of the gateway.",
                 roleMap.containsKey("gateway-user") ? roleMap.get("gateway-user") : Collections.emptyList());
-        gatewayGroups.setDefaultGatewayUsersGroupId(gatewayUsersGroup.groupId);
+        gatewayGroups.setDefaultGatewayUsersGroupId(gatewayUsersGroup.getGroupId());
 
         UserGroup adminUsersGroup = createGroup(sharingRegistryServerHandler, domain, ownerId,
                 "Admin Users",
                 "Admin users group.",
                 roleMap.containsKey("admin") ? roleMap.get("admin") : Collections.emptyList());
-        gatewayGroups.setAdminsGroupId(adminUsersGroup.groupId);
+        gatewayGroups.setAdminsGroupId(adminUsersGroup.getGroupId());
 
         UserGroup readOnlyAdminsGroup = createGroup(sharingRegistryServerHandler, domain, ownerId,
                 "Read Only Admin Users",
                 "Group of admin users with read-only access.",
                 roleMap.containsKey("admin-read-only") ? roleMap.get("admin-read-only") : Collections.emptyList());
-        gatewayGroups.setReadOnlyAdminsGroupId(readOnlyAdminsGroup.groupId);
+        gatewayGroups.setReadOnlyAdminsGroupId(readOnlyAdminsGroup.getGroupId());
 
         registryServiceClient.createGatewayGroups(gatewayGroups);
         return gatewayGroups;
@@ -462,13 +462,13 @@ public class AiravataDataMigrator {
     private static String getAdminOwnerUser(Domain domain, SharingRegistryServerHandler sharingRegistryServerHandler, CredentialStoreService.Client credentialStoreServiceClient, RegistryService.Client registryServiceClient) throws TException {
         GatewayResourceProfile gatewayResourceProfile = null;
         try {
-            gatewayResourceProfile = registryServiceClient.getGatewayResourceProfile(domain.domainId);
+            gatewayResourceProfile = registryServiceClient.getGatewayResourceProfile(domain.getDomainId());
         } catch (Exception e) {
-            System.out.println("Skipping creating group based auth migration for " + domain.domainId + " because it doesn't have a GatewayResourceProfile");
+            System.out.println("Skipping creating group based auth migration for " + domain.getDomainId() + " because it doesn't have a GatewayResourceProfile");
             return null;
         }
         if (gatewayResourceProfile.getIdentityServerPwdCredToken() == null) {
-            System.out.println("Skipping creating group based auth migration for " + domain.domainId + " because it doesn't have an identity server pwd credential token");
+            System.out.println("Skipping creating group based auth migration for " + domain.getDomainId() + " because it doesn't have an identity server pwd credential token");
             return null;
         }
         String groupOwner = null;
@@ -477,13 +477,13 @@ public class AiravataDataMigrator {
                     gatewayResourceProfile.getIdentityServerPwdCredToken(), gatewayResourceProfile.getGatewayID());
             groupOwner = credential.getLoginUserName();
         } catch (Exception e) {
-            System.out.println("Skipping creating group based auth migration for " + domain.domainId + " because the identity server pwd credential could not be retrieved.");
+            System.out.println("Skipping creating group based auth migration for " + domain.getDomainId() + " because the identity server pwd credential could not be retrieved.");
             return null;
         }
 
-        String ownerId = groupOwner + "@" + domain.domainId;
-        if (!sharingRegistryServerHandler.isUserExists(domain.domainId, ownerId)) {
-            System.out.println("Skipping creating group based auth migration for " + domain.domainId + " because admin user doesn't exist in sharing registry.");
+        String ownerId = groupOwner + "@" + domain.getDomainId();
+        if (!sharingRegistryServerHandler.isUserExists(domain.getDomainId(), ownerId)) {
+            System.out.println("Skipping creating group based auth migration for " + domain.getDomainId() + " because admin user doesn't exist in sharing registry.");
             return null;
         }
         return ownerId;
@@ -527,7 +527,7 @@ public class AiravataDataMigrator {
 
         UserGroup userGroup = new UserGroup();
         userGroup.setGroupId(AiravataUtils.getId(groupName));
-        userGroup.setDomainId(domain.domainId);
+        userGroup.setDomainId(domain.getDomainId());
         userGroup.setGroupCardinality(GroupCardinality.MULTI_USER);
         userGroup.setCreatedTime(System.currentTimeMillis());
         userGroup.setUpdatedTime(System.currentTimeMillis());
@@ -538,10 +538,10 @@ public class AiravataDataMigrator {
         sharingRegistryServerHandler.createGroup(userGroup);
 
         List<String> userIds = usernames.stream()
-                .map(username -> username + "@" + domain.domainId)
+                .map(username -> username + "@" + domain.getDomainId())
                 .collect(Collectors.toList());
 
-        sharingRegistryServerHandler.addUsersToGroup(domain.domainId, userIds, userGroup.getGroupId());
+        sharingRegistryServerHandler.addUsersToGroup(domain.getDomainId(), userIds, userGroup.getGroupId());
         return userGroup;
     }
 
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
index c151361..f72a570 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
@@ -197,26 +197,26 @@ public class SharingServiceDBEventHandler implements MessageHandler {
                                     log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.getDomainId()+":FILE", ex);
                                 }
 
-                                log.info("Creating entity type. Id : " + domain.domainId+":"+ResourceType.APPLICATION_DEPLOYMENT);
+                                log.info("Creating entity type. Id : " + domain.getDomainId()+":"+ResourceType.APPLICATION_DEPLOYMENT);
                                 entityType = new org.apache.airavata.sharing.registry.models.EntityType();
-                                entityType.setEntityTypeId(domain.domainId+":"+ ResourceType.APPLICATION_DEPLOYMENT.name());
-                                entityType.setDomainId(domain.domainId);
+                                entityType.setEntityTypeId(domain.getDomainId()+":"+ ResourceType.APPLICATION_DEPLOYMENT.name());
+                                entityType.setDomainId(domain.getDomainId());
                                 entityType.setName("APPLICATION-DEPLOYMENT");
                                 entityType.setDescription("Application Deployment entity type");
                                 sharingRegistryClient.createEntityType(entityType);
 
-                                log.info("Creating entity type. Id : " + domain.domainId+":"+ResourceType.GROUP_RESOURCE_PROFILE);
+                                log.info("Creating entity type. Id : " + domain.getDomainId()+":"+ResourceType.GROUP_RESOURCE_PROFILE);
                                 entityType = new org.apache.airavata.sharing.registry.models.EntityType();
-                                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
-                                entityType.setDomainId(domain.domainId);
+                                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.GROUP_RESOURCE_PROFILE.name());
+                                entityType.setDomainId(domain.getDomainId());
                                 entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
                                 entityType.setDescription("Group Resource Profile entity type");
                                 sharingRegistryClient.createEntityType(entityType);
 
-                                log.info("Creating entity type. Id : " + domain.domainId+":"+ResourceType.CREDENTIAL_TOKEN);
+                                log.info("Creating entity type. Id : " + domain.getDomainId()+":"+ResourceType.CREDENTIAL_TOKEN);
                                 entityType = new org.apache.airavata.sharing.registry.models.EntityType();
-                                entityType.setEntityTypeId(domain.domainId+":"+ResourceType.CREDENTIAL_TOKEN.name());
-                                entityType.setDomainId(domain.domainId);
+                                entityType.setEntityTypeId(domain.getDomainId()+":"+ResourceType.CREDENTIAL_TOKEN.name());
+                                entityType.setDomainId(domain.getDomainId());
                                 entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
                                 entityType.setDescription("Credential Store Token entity type");
                                 sharingRegistryClient.createEntityType(entityType);
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
index 40eaef5..f4b08ae 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -876,7 +876,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             return entity.getEntityId();
         }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            SharingRegistryException sharingRegistryException = new SharingRegistryException();
+            sharingRegistryException.setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            throw sharingRegistryException;
         }
     }
 
@@ -911,14 +913,14 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             entity.setCreatedTime(oldEntity.getCreatedTime());
             // check if parent entity changed and re-add inherited permissions
             if (!Objects.equals(oldEntity.getParentEntityId(), entity.getParentEntityId())) {
-                logger.debug("Parent entity changed for {}, updating inherited permissions", entity.entityId);
+                logger.debug("Parent entity changed for {}, updating inherited permissions", entity.getEntityId());
                 if (oldEntity.getParentEntityId() != null && oldEntity.getParentEntityId() != "") {
-                    logger.debug("Removing inherited permissions from {} that were inherited from parent {}", entity.entityId, oldEntity.getParentEntityId());
-                    (new SharingRepository()).removeAllIndirectCascadingPermissionsForEntity(entity.domainId, entity.entityId);
+                    logger.debug("Removing inherited permissions from {} that were inherited from parent {}", entity.getEntityId(), oldEntity.getParentEntityId());
+                    (new SharingRepository()).removeAllIndirectCascadingPermissionsForEntity(entity.getDomainId(), entity.getEntityId());
                 }
                 if (entity.getParentEntityId() != null && entity.getParentEntityId() != "") {
                     // re-add INDIRECT_CASCADING permissions
-                    logger.debug("Adding inherited permissions to {} that are inherited from parent {}", entity.entityId, entity.getParentEntityId());
+                    logger.debug("Adding inherited permissions to {} that are inherited from parent {}", entity.getEntityId(), entity.getParentEntityId());
                     addCascadingPermissionsForEntity(entity);
                 }
             }
@@ -1009,7 +1011,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             return (new UserRepository()).getDirectlyAccessibleUsers(domainId, entityId, permissionTypeId);
         }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            SharingRegistryException sharingRegistryException = new SharingRegistryException();
+            sharingRegistryException.setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            throw sharingRegistryException;
         }
     }
 
@@ -1030,7 +1034,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             return (new UserGroupRepository()).getDirectlyAccessibleGroups(domainId, entityId, permissionTypeId);
         }catch (Throwable ex) {
             logger.error(ex.getMessage(), ex);
-            throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            SharingRegistryException sharingRegistryException = new SharingRegistryException();
+            sharingRegistryException.setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+            throw sharingRegistryException;
         }
     }