You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2019/05/02 18:50:38 UTC
[airavata] branch master updated: Removed private variable access
of sharing registry data models
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/master by this push:
new 5a4088d Removed private variable access of sharing registry data models
5a4088d is described below
commit 5a4088d2ad0e1abf67eaf34ce37a61411a2e1283
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Thu May 2 14:50:27 2019 -0400
Removed private variable access of sharing registry data models
---
.../api/server/handler/AiravataServerHandler.java | 62 ++---
.../migrator/airavata/AiravataDataMigrator.java | 40 ++--
.../registry/db/repositories/EntityRepository.java | 4 +-
.../db/repositories/GroupMembershipRepository.java | 2 +-
.../messaging/SharingServiceDBEventHandler.java | 52 ++---
.../server/SharingRegistryServerHandler.java | 252 ++++++++++-----------
.../registry/SharingRegistryServiceTest.java | 2 +-
7 files changed, 207 insertions(+), 207 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 4655a78..2e7b0d8 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
@@ -194,48 +194,48 @@ public class AiravataServerHandler implements Airavata.Iface {
Domain domain = new Domain();
domain.setDomainId(ServerSettings.getDefaultUserGateway());
domain.setName(ServerSettings.getDefaultUserGateway());
- domain.setDescription("Domain entry for " + domain.name);
+ domain.setDescription("Domain entry for " + domain.getName());
client.createDomain(domain);
User user = new User();
- user.setDomainId(domain.domainId);
+ user.setDomainId(domain.getDomainId());
user.setUserId(ServerSettings.getDefaultUser() + "@" + ServerSettings.getDefaultUserGateway());
user.setUserName(ServerSettings.getDefaultUser());
client.createUser(user);
//Creating Entity Types for each domain
EntityType entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId + ":PROJECT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId() + ":PROJECT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("PROJECT");
entityType.setDescription("Project entity type");
client.createEntityType(entityType);
entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId + ":EXPERIMENT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("EXPERIMENT");
entityType.setDescription("Experiment entity type");
client.createEntityType(entityType);
entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId + ":FILE");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("FILE");
entityType.setDescription("File entity type");
client.createEntityType(entityType);
//Creating Permission Types for each domain
PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId + ":READ");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":READ");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("READ");
permissionType.setDescription("Read permission type");
client.createPermissionType(permissionType);
permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId + ":WRITE");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("WRITE");
permissionType.setDescription("Write permission type");
client.createPermissionType(permissionType);
@@ -292,42 +292,42 @@ public class AiravataServerHandler implements Airavata.Iface {
Domain domain = new Domain();
domain.setDomainId(gateway.getGatewayId());
domain.setName(gateway.getGatewayName());
- domain.setDescription("Domain entry for " + domain.name);
+ domain.setDescription("Domain entry for " + domain.getName());
sharingClient.createDomain(domain);
//Creating Entity Types for each domain
EntityType entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId+":PROJECT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":PROJECT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("PROJECT");
entityType.setDescription("Project entity type");
sharingClient.createEntityType(entityType);
entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":EXPERIMENT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("EXPERIMENT");
entityType.setDescription("Experiment entity type");
sharingClient.createEntityType(entityType);
entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId+":FILE");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":FILE");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("FILE");
entityType.setDescription("File entity type");
sharingClient.createEntityType(entityType);
//Creating Permission Types for each domain
PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":READ");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":READ");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("READ");
permissionType.setDescription("Read permission type");
sharingClient.createPermissionType(permissionType);
permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":WRITE");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":WRITE");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("WRITE");
permissionType.setDescription("Write permission type");
sharingClient.createPermissionType(permissionType);
@@ -1001,7 +1001,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 -> accessibleProjectIds
- .add(p.entityId));
+ .add(p.getEntityId()));
List<Project> result = regClient.searchProjects(gatewayId, userName, accessibleProjectIds, new HashMap<>(), limit, offset);
registryClientPool.returnResource(regClient);
sharingClientPool.returnResource(sharingClient);
@@ -1062,7 +1062,7 @@ public class AiravataServerHandler implements Airavata.Iface {
searchCriteria.setValue(gatewayId + ":PROJECT");
sharingFilters.add(searchCriteria);
sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
- userName + "@" + gatewayId, sharingFilters, 0, -1).stream().forEach(e -> accessibleProjIds.add(e.entityId));
+ userName + "@" + gatewayId, sharingFilters, 0, -1).stream().forEach(e -> accessibleProjIds.add(e.getEntityId()));
}
List<Project> result = regClient.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
registryClientPool.returnResource(regClient);
@@ -1112,7 +1112,7 @@ public class AiravataServerHandler implements Airavata.Iface {
searchCriteria.setValue(gatewayId + ":EXPERIMENT");
sharingFilters.add(searchCriteria);
sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
- userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(e -> accessibleExpIds.add(e.entityId));
+ userName + "@" + gatewayId, sharingFilters, 0, -1).forEach(e -> accessibleExpIds.add(e.getEntityId()));
}
List<ExperimentSummaryModel> result = regClient.searchExperiments(gatewayId, userName, accessibleExpIds, filters, limit, offset);
registryClientPool.returnResource(regClient);
@@ -4832,21 +4832,21 @@ public class AiravataServerHandler implements Airavata.Iface {
if (permissionType.equals(ResourcePermissionType.WRITE)) {
sharingClient.getListOfSharedUsers(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
resourceId, authzToken.getClaimsMap().get(Constants.GATEWAY_ID)
- + ":WRITE").stream().forEach(u -> accessibleUsers.add(u.userId));
+ + ":WRITE").stream().forEach(u -> accessibleUsers.add(u.getUserId()));
sharingClient.getListOfSharedUsers(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
resourceId, authzToken.getClaimsMap().get(Constants.GATEWAY_ID)
- + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.userId));
+ + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.getUserId()));
} else if (permissionType.equals(ResourcePermissionType.READ)) {
sharingClient.getListOfSharedUsers(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
resourceId, authzToken.getClaimsMap().get(Constants.GATEWAY_ID)
- + ":READ").stream().forEach(u -> accessibleUsers.add(u.userId));
+ + ":READ").stream().forEach(u -> accessibleUsers.add(u.getUserId()));
sharingClient.getListOfSharedUsers(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
resourceId, authzToken.getClaimsMap().get(Constants.GATEWAY_ID)
- + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.userId));
+ + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.getUserId()));
} else if (permissionType.equals(ResourcePermissionType.OWNER)) {
sharingClient.getListOfSharedUsers(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
resourceId, authzToken.getClaimsMap().get(Constants.GATEWAY_ID)
- + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.userId));
+ + ":OWNER").stream().forEach(u -> accessibleUsers.add(u.getUserId()));
}
registryClientPool.returnResource(regClient);
sharingClientPool.returnResource(sharingClient);
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 b9bfe99..ece5889 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
@@ -48,51 +48,51 @@ public class AiravataDataMigrator {
Domain domain = new Domain();
domain.setDomainId(rs.getString("GATEWAY_ID"));
domain.setName(rs.getString("GATEWAY_ID"));
- domain.setDescription("Domain entry for " + domain.name);
+ domain.setDescription("Domain entry for " + domain.getName());
- if (!sharingRegistryServerHandler.isDomainExists(domain.domainId))
+ if (!sharingRegistryServerHandler.isDomainExists(domain.getDomainId()))
sharingRegistryServerHandler.createDomain(domain);
//Creating Entity Types for each domain
EntityType entityType = new EntityType();
- entityType.setEntityTypeId(domain.domainId+":PROJECT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":PROJECT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("PROJECT");
entityType.setDescription("Project 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+":EXPERIMENT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":EXPERIMENT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("EXPERIMENT");
entityType.setDescription("Experiment 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+":FILE");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":FILE");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("FILE");
entityType.setDescription("File 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
PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":READ");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":READ");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("READ");
permissionType.setDescription("Read permission type");
- if (!sharingRegistryServerHandler.isPermissionExists(permissionType.domainId, permissionType.permissionTypeId))
+ if (!sharingRegistryServerHandler.isPermissionExists(permissionType.getDomainId(), permissionType.getPermissionTypeId()))
sharingRegistryServerHandler.createPermissionType(permissionType);
permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":WRITE");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":WRITE");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("WRITE");
permissionType.setDescription("Write permission type");
- if (!sharingRegistryServerHandler.isPermissionExists(permissionType.domainId, permissionType.permissionTypeId))
+ if (!sharingRegistryServerHandler.isPermissionExists(permissionType.getDomainId(), permissionType.getPermissionTypeId()))
sharingRegistryServerHandler.createPermissionType(permissionType);
}catch (Exception ex){
ex.printStackTrace();
@@ -110,7 +110,7 @@ public class AiravataDataMigrator {
user.setDomainId(rs.getString("GATEWAY_ID"));
user.setUserName(rs.getString("USER_NAME"));
- if (!sharingRegistryServerHandler.isUserExists(user.domainId, user.userId))
+ if (!sharingRegistryServerHandler.isUserExists(user.getDomainId(), user.getUserId()))
sharingRegistryServerHandler.createUser(user);
}catch (Exception ex){
ex.printStackTrace();
@@ -138,7 +138,7 @@ public class AiravataDataMigrator {
Map<String, String> metadata = new HashMap<>();
metadata.put("CREATION_TIME", rs.getDate("CREATION_TIME").toString());
- if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+ if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
sharingRegistryServerHandler.createEntity(entity);
}catch (Exception ex) {
ex.printStackTrace();
@@ -174,7 +174,7 @@ public class AiravataDataMigrator {
metadata.put("GATEWAY_INSTANCE_ID", rs.getString("GATEWAY_INSTANCE_ID"));
metadata.put("ARCHIVE", rs.getString("ARCHIVE"));
- if (!sharingRegistryServerHandler.isEntityExists(entity.domainId, entity.entityId))
+ if (!sharingRegistryServerHandler.isEntityExists(entity.getDomainId(), entity.getEntityId()))
sharingRegistryServerHandler.createEntity(entity);
}catch (Exception ex){
ex.printStackTrace();
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
index 9b1bdbe..a168e8b 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
@@ -158,9 +158,9 @@ public class EntityRepository extends AbstractRepository<Entity, EntityEntity, E
entity.setUpdatedTime((long) (rs[12]));
//Removing duplicates. Another option is to change the query to remove duplicates.
- if (!keys.containsKey(entity + domainId + "," + entity.entityId)) {
+ if (!keys.containsKey(entity + domainId + "," + entity.getEntityId())) {
resultSet.add(entity);
- keys.put(entity + domainId + "," + entity.entityId, null);
+ keys.put(entity + domainId + "," + entity.getEntityId(), null);
}
});
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/GroupMembershipRepository.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/GroupMembershipRepository.java
index c267dec..5aba85e 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/GroupMembershipRepository.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/GroupMembershipRepository.java
@@ -92,7 +92,7 @@ public class GroupMembershipRepository extends AbstractRepository<GroupMembershi
while (temp.size() > 0){
GroupMembership gm = temp.pop();
filters = new HashMap<>();
- filters.put(DBConstants.GroupMembershipTable.CHILD_ID, gm.parentId);
+ filters.put(DBConstants.GroupMembershipTable.CHILD_ID, gm.getParentId());
filters.put(DBConstants.GroupMembershipTable.DOMAIN_ID, domainId);
select(filters, 0, -1).stream().forEach(m -> temp.addLast(m));
finalParentGroups.add(gm);
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 3db4be7..e9c2d37 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
@@ -147,7 +147,7 @@ public class SharingServiceDBEventHandler implements MessageHandler {
Domain domain = new Domain();
domain.setDomainId(gateway.getGatewayId());
domain.setName(gateway.getGatewayName());
- domain.setDescription("Domain entry for " + domain.name);
+ domain.setDescription("Domain entry for " + domain.getName());
try{
sharingRegistryClient.createDomain(domain);
log.debug("Domain created. Id : " + gateway.getGatewayId());
@@ -156,70 +156,70 @@ public class SharingServiceDBEventHandler implements MessageHandler {
}
//Creating Entity Types for each domain
- log.info("Creating entity type. Id : " + domain.domainId+":PROJECT");
+ log.info("Creating entity type. Id : " + domain.getDomainId()+":PROJECT");
org.apache.airavata.sharing.registry.models.EntityType entityType = new org.apache.airavata.sharing.registry.models.EntityType();
- entityType.setEntityTypeId(domain.domainId+":PROJECT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":PROJECT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("PROJECT");
entityType.setDescription("Project entity type");
try {
sharingRegistryClient.createEntityType(entityType);
- log.debug("Entity type created. Id : " + domain.domainId+":PROJECT");
+ log.debug("Entity type created. Id : " + domain.getDomainId()+":PROJECT");
} catch (DuplicateEntryException ex) {
- log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.domainId+":PROJECT", ex);
+ log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.getDomainId()+":PROJECT", ex);
}
- log.info("Creating entity type. Id : " + domain.domainId+":EXPERIMENT");
+ log.info("Creating entity type. Id : " + domain.getDomainId()+":EXPERIMENT");
entityType = new org.apache.airavata.sharing.registry.models.EntityType();
- entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":EXPERIMENT");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("EXPERIMENT");
entityType.setDescription("Experiment entity type");
try{
sharingRegistryClient.createEntityType(entityType);
- log.debug("Entity type created. Id : " + domain.domainId+":EXPERIMENT");
+ log.debug("Entity type created. Id : " + domain.getDomainId()+":EXPERIMENT");
} catch (DuplicateEntryException ex) {
- log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.domainId+":EXPERIMENT", ex);
+ log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.getDomainId()+":EXPERIMENT", ex);
}
- log.info("Creating entity type. Id : " + domain.domainId+":FILE");
+ log.info("Creating entity type. Id : " + domain.getDomainId()+":FILE");
entityType = new org.apache.airavata.sharing.registry.models.EntityType();
- entityType.setEntityTypeId(domain.domainId+":FILE");
- entityType.setDomainId(domain.domainId);
+ entityType.setEntityTypeId(domain.getDomainId()+":FILE");
+ entityType.setDomainId(domain.getDomainId());
entityType.setName("FILE");
entityType.setDescription("File entity type");
try {
sharingRegistryClient.createEntityType(entityType);
- log.debug("Entity type created. Id : " + domain.domainId + ":FILE");
+ log.debug("Entity type created. Id : " + domain.getDomainId() + ":FILE");
} catch (DuplicateEntryException ex) {
- log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.domainId+":FILE", ex);
+ log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Entity Id : " + domain.getDomainId()+":FILE", ex);
}
//Creating Permission Types for each domain
- log.info("Creating Permission Type. Id : " + domain.domainId+":READ");
+ log.info("Creating Permission Type. Id : " + domain.getDomainId()+":READ");
PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":READ");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":READ");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("READ");
permissionType.setDescription("Read permission type");
try {
sharingRegistryClient.createPermissionType(permissionType);
- log.debug("Permission Type created. Id : " + domain.domainId + ":READ");
+ log.debug("Permission Type created. Id : " + domain.getDomainId() + ":READ");
} catch (DuplicateEntryException ex) {
- log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Permission Id : " + domain.domainId+":READ", ex);
+ log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Permission Id : " + domain.getDomainId()+":READ", ex);
}
- log.info("Creating Permission Type. Id : " + domain.domainId+":WRITE");
+ log.info("Creating Permission Type. Id : " + domain.getDomainId()+":WRITE");
permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId+":WRITE");
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId()+":WRITE");
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName("WRITE");
permissionType.setDescription("Write permission type");
try {
sharingRegistryClient.createPermissionType(permissionType);
- log.debug("Permission Type created. Id : " + domain.domainId + ":WRITE");
+ log.debug("Permission Type created. Id : " + domain.getDomainId() + ":WRITE");
} catch (DuplicateEntryException ex) {
- log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Permission Id : " + domain.domainId + ":WRITE", ex);
+ log.warn("DuplicateEntryException while consuming TENANT create message, ex: " + ex.getMessage() + ", Permission Id : " + domain.getDomainId() + ":WRITE", ex);
}
break;
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 3180405..252e095 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
@@ -58,7 +58,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public String createDomain(Domain domain) throws SharingRegistryException, DuplicateEntryException, TException {
try{
domain.setDomainId(domain.getName());
- if((new DomainRepository()).get(domain.domainId) != null)
+ if((new DomainRepository()).get(domain.getDomainId()) != null)
throw new DuplicateEntryException("There exist domain with given domain id");
domain.setCreatedTime(System.currentTimeMillis());
@@ -67,33 +67,33 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
//create the global permission for the domain
PermissionType permissionType = new PermissionType();
- permissionType.setPermissionTypeId(domain.domainId + ":" + OWNER_PERMISSION_NAME);
- permissionType.setDomainId(domain.domainId);
+ permissionType.setPermissionTypeId(domain.getDomainId() + ":" + OWNER_PERMISSION_NAME);
+ permissionType.setDomainId(domain.getDomainId());
permissionType.setName(OWNER_PERMISSION_NAME);
- permissionType.setDescription("GLOBAL permission to " + domain.domainId);
+ permissionType.setDescription("GLOBAL permission to " + domain.getDomainId());
permissionType.setCreatedTime(System.currentTimeMillis());
permissionType.setUpdatedTime(System.currentTimeMillis());
(new PermissionTypeRepository()).create(permissionType);
- return domain.domainId;
+ return domain.getDomainId();
}catch (Throwable ex){
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@Override
public boolean updateDomain(Domain domain) throws SharingRegistryException, TException {
try{
- Domain oldDomain = (new DomainRepository()).get(domain.domainId);
- domain.setCreatedTime(oldDomain.createdTime);
+ Domain oldDomain = (new DomainRepository()).get(domain.getDomainId());
+ domain.setCreatedTime(oldDomain.getCreatedTime());
domain.setUpdatedTime(System.currentTimeMillis());
domain = getUpdatedObject(oldDomain, domain);
(new DomainRepository()).update(domain);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -108,7 +108,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new DomainRepository()).isExists(domainId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -119,7 +119,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -129,7 +129,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new DomainRepository()).get(domainId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -139,7 +139,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new DomainRepository()).select(new HashMap<>(), offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -152,7 +152,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
try{
UserPK userPK = new UserPK();
userPK.setUserId(user.getUserId());
- userPK.setDomainId(user.domainId);
+ userPK.setDomainId(user.getDomainId());
if((new UserRepository()).get(userPK) != null)
throw new DuplicateEntryException("There exist user with given user id");
@@ -161,19 +161,19 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
(new UserRepository()).create(user);
UserGroup userGroup = new UserGroup();
- userGroup.setGroupId(user.userId);
- userGroup.setDomainId(user.domainId);
- userGroup.setName(user.userName);
- userGroup.setDescription("user " + user.userName + " group");
- userGroup.setOwnerId(user.userId);
+ userGroup.setGroupId(user.getUserId());
+ userGroup.setDomainId(user.getDomainId());
+ userGroup.setName(user.getUserName());
+ userGroup.setDescription("user " + user.getUserName() + " group");
+ userGroup.setOwnerId(user.getUserId());
userGroup.setGroupType(GroupType.USER_LEVEL_GROUP);
userGroup.setGroupCardinality(GroupCardinality.SINGLE_USER);
(new UserGroupRepository()).create(userGroup);
- return user.userId;
+ return user.getUserId();
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -181,25 +181,25 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public boolean updatedUser(User user) throws SharingRegistryException, TException {
try{
UserPK userPK = new UserPK();
- userPK.setUserId(user.userId);
- userPK.setDomainId(user.domainId);
+ userPK.setUserId(user.getUserId());
+ userPK.setDomainId(user.getDomainId());
User oldUser = (new UserRepository()).get(userPK);
- user.setCreatedTime(oldUser.createdTime);
+ user.setCreatedTime(oldUser.getCreatedTime());
user.setUpdatedTime(System.currentTimeMillis());
user = getUpdatedObject(oldUser, user);
(new UserRepository()).update(user);
UserGroupPK userGroupPK = new UserGroupPK();
userGroupPK.setGroupId(user.getUserId());
- userGroupPK.setDomainId(user.domainId);
+ userGroupPK.setDomainId(user.getDomainId());
UserGroup userGroup = (new UserGroupRepository()).get(userGroupPK);
- userGroup.setName(user.userName);
- userGroup.setDescription("user " + user.userName + " group");
+ userGroup.setName(user.getUserName());
+ userGroup.setDescription("user " + user.getUserName() + " group");
updateGroup(userGroup);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -217,7 +217,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserRepository()).isExists(userPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -236,7 +236,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -249,7 +249,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserRepository()).get(userPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -261,7 +261,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserRepository()).select(filters, offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -273,8 +273,8 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public String createGroup(UserGroup group) throws SharingRegistryException, TException {
try{
UserGroupPK userGroupPK = new UserGroupPK();
- userGroupPK.setGroupId(group.groupId);
- userGroupPK.setDomainId(group.domainId);
+ userGroupPK.setGroupId(group.getGroupId());
+ userGroupPK.setDomainId(group.getDomainId());
if((new UserGroupRepository()).get(userGroupPK) != null)
throw new SharingRegistryException("There exist group with given group id");
//Client created groups are always of type MULTI_USER
@@ -283,11 +283,11 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
group.setUpdatedTime(System.currentTimeMillis());
(new UserGroupRepository()).create(group);
- addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId);
- return group.groupId;
+ addUsersToGroup(group.getDomainId(), Arrays.asList(group.getOwnerId()), group.getGroupId());
+ return group.getGroupId();
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -296,22 +296,22 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
try{
group.setUpdatedTime(System.currentTimeMillis());
UserGroupPK userGroupPK = new UserGroupPK();
- userGroupPK.setGroupId(group.groupId);
- userGroupPK.setDomainId(group.domainId);
+ userGroupPK.setGroupId(group.getGroupId());
+ userGroupPK.setDomainId(group.getDomainId());
UserGroup oldGroup = (new UserGroupRepository()).get(userGroupPK);
//Client created groups are always of type MULTI_USER
group.setGroupCardinality(GroupCardinality.MULTI_USER);
- group.setCreatedTime(oldGroup.createdTime);
+ group.setCreatedTime(oldGroup.getCreatedTime());
group = getUpdatedObject(oldGroup, group);
- if(!group.ownerId.equals(oldGroup.ownerId))
+ if(!group.getOwnerId().equals(oldGroup.getOwnerId()))
throw new SharingRegistryException("Group owner cannot be changed");
(new UserGroupRepository()).update(group);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -332,7 +332,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserGroupRepository()).isExists(userGroupPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -346,7 +346,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -359,7 +359,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserGroupRepository()).get(userGroupPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -371,7 +371,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserGroupRepository()).select(filters, offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -391,7 +391,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -408,7 +408,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -431,7 +431,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
newUserGroup.setUpdatedTime(System.currentTimeMillis());
newUserGroup.setOwnerId(newOwnerId);
newUserGroup.setGroupCardinality(GroupCardinality.MULTI_USER);
- newUserGroup.setCreatedTime(userGroup.createdTime);
+ newUserGroup.setCreatedTime(userGroup.getCreatedTime());
newUserGroup = getUpdatedObject(userGroup, newUserGroup);
(new UserGroupRepository()).update(newUserGroup);
@@ -440,7 +440,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
}
catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -466,7 +466,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
}
catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -484,7 +484,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
}
catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -502,7 +502,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
}
catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -514,13 +514,13 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
userGroupPK.setDomainId(domainId);
UserGroup getGroup = (new UserGroupRepository()).get(userGroupPK);
- if(getGroup.ownerId.equals(ownerId))
+ if(getGroup.getOwnerId().equals(ownerId))
return true;
return false;
}
catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -532,7 +532,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return groupMemberUsers;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -544,7 +544,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return groupMemberGroups;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -565,7 +565,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -580,7 +580,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -591,7 +591,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return groupMembershipRepository.getAllMemberGroupsForUser(domainId, userId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -603,18 +603,18 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public String createEntityType(EntityType entityType) throws SharingRegistryException, DuplicateEntryException, TException {
try{
EntityTypePK entityTypePK = new EntityTypePK();
- entityTypePK.setDomainId(entityType.domainId);
- entityTypePK.setEntityTypeId(entityType.entityTypeId);
+ entityTypePK.setDomainId(entityType.getDomainId());
+ entityTypePK.setEntityTypeId(entityType.getEntityTypeId());
if((new EntityTypeRepository()).get(entityTypePK) != null)
throw new DuplicateEntryException("There exist EntityType with given EntityType id");
entityType.setCreatedTime(System.currentTimeMillis());
entityType.setUpdatedTime(System.currentTimeMillis());
(new EntityTypeRepository()).create(entityType);
- return entityType.entityTypeId;
+ return entityType.getEntityTypeId();
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -623,16 +623,16 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
try{
entityType.setUpdatedTime(System.currentTimeMillis());
EntityTypePK entityTypePK = new EntityTypePK();
- entityTypePK.setDomainId(entityType.domainId);
- entityTypePK.setEntityTypeId(entityType.entityTypeId);
+ entityTypePK.setDomainId(entityType.getDomainId());
+ entityTypePK.setEntityTypeId(entityType.getEntityTypeId());
EntityType oldEntityType = (new EntityTypeRepository()).get(entityTypePK);
- entityType.setCreatedTime(oldEntityType.createdTime);
+ entityType.setCreatedTime(oldEntityType.getCreatedTime());
entityType = getUpdatedObject(oldEntityType, entityType);
(new EntityTypeRepository()).update(entityType);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -650,7 +650,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new EntityTypeRepository()).isExists(entityTypePK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -664,7 +664,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -677,7 +677,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new EntityTypeRepository()).get(entityTypePK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -689,7 +689,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new EntityTypeRepository()).select(filters, offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -701,17 +701,17 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public String createPermissionType(PermissionType permissionType) throws SharingRegistryException, DuplicateEntryException, TException {
try{
PermissionTypePK permissionTypePK = new PermissionTypePK();
- permissionTypePK.setDomainId(permissionType.domainId);
- permissionTypePK.setPermissionTypeId(permissionType.permissionTypeId);
+ permissionTypePK.setDomainId(permissionType.getDomainId());
+ permissionTypePK.setPermissionTypeId(permissionType.getPermissionTypeId());
if((new PermissionTypeRepository()).get(permissionTypePK) != null)
throw new DuplicateEntryException("There exist PermissionType with given PermissionType id");
permissionType.setCreatedTime(System.currentTimeMillis());
permissionType.setUpdatedTime(System.currentTimeMillis());
(new PermissionTypeRepository()).create(permissionType);
- return permissionType.permissionTypeId;
+ return permissionType.getPermissionTypeId();
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -720,15 +720,15 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
try{
permissionType.setUpdatedTime(System.currentTimeMillis());
PermissionTypePK permissionTypePK = new PermissionTypePK();
- permissionTypePK.setDomainId(permissionType.domainId);
- permissionTypePK.setPermissionTypeId(permissionType.permissionTypeId);
+ permissionTypePK.setDomainId(permissionType.getDomainId());
+ permissionTypePK.setPermissionTypeId(permissionType.getPermissionTypeId());
PermissionType oldPermissionType = (new PermissionTypeRepository()).get(permissionTypePK);
permissionType = getUpdatedObject(oldPermissionType, permissionType);
(new PermissionTypeRepository()).update(permissionType);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -746,7 +746,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new PermissionTypeRepository()).isExists(permissionTypePK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -760,7 +760,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -773,7 +773,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new PermissionTypeRepository()).get(permissionTypePK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -785,7 +785,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new PermissionTypeRepository()).select(filters, offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -797,39 +797,39 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
public String createEntity(Entity entity) throws SharingRegistryException, DuplicateEntryException, TException {
try{
EntityPK entityPK = new EntityPK();
- entityPK.setDomainId(entity.domainId);
- entityPK.setEntityId(entity.entityId);
+ entityPK.setDomainId(entity.getDomainId());
+ entityPK.setEntityId(entity.getEntityId());
if((new EntityRepository()).get(entityPK) != null)
throw new DuplicateEntryException("There exist Entity with given Entity id");
UserPK userPK = new UserPK();
- userPK.setDomainId(entity.domainId);
- userPK.setUserId(entity.ownerId);
+ userPK.setDomainId(entity.getDomainId());
+ userPK.setUserId(entity.getOwnerId());
if(!(new UserRepository()).isExists(userPK)){
//Todo this is for Airavata easy integration. Proper thing is to throw an exception here
User user = new User();
user.setUserId(entity.getOwnerId());
- user.setDomainId(entity.domainId);
- user.setUserName(user.userId.split("@")[0]);
+ user.setDomainId(entity.getDomainId());
+ user.setUserName(user.getUserId().split("@")[0]);
createUser(user);
}
entity.setCreatedTime(System.currentTimeMillis());
entity.setUpdatedTime(System.currentTimeMillis());
- if(entity.originalEntityCreationTime==0){
- entity.originalEntityCreationTime = entity.createdTime;
+ if(entity.getOriginalEntityCreationTime()==0){
+ entity.setOriginalEntityCreationTime(entity.getCreatedTime());
}
(new EntityRepository()).create(entity);
//Assigning global permission for the owner
Sharing newSharing = new Sharing();
- newSharing.setPermissionTypeId((new PermissionTypeRepository()).getOwnerPermissionTypeIdForDomain(entity.domainId));
- newSharing.setEntityId(entity.entityId);
- newSharing.setGroupId(entity.ownerId);
+ newSharing.setPermissionTypeId((new PermissionTypeRepository()).getOwnerPermissionTypeIdForDomain(entity.getDomainId()));
+ newSharing.setEntityId(entity.getEntityId());
+ newSharing.setGroupId(entity.getOwnerId());
newSharing.setSharingType(SharingType.DIRECT_CASCADING);
- newSharing.setInheritedParentId(entity.entityId);
- newSharing.setDomainId(entity.domainId);
+ newSharing.setInheritedParentId(entity.getEntityId());
+ newSharing.setDomainId(entity.getDomainId());
newSharing.setCreatedTime(System.currentTimeMillis());
newSharing.setUpdatedTime(System.currentTimeMillis());
@@ -837,15 +837,15 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
//creating records for inherited permissions
if(entity.getParentEntityId() != null && entity.getParentEntityId() != ""){
- List<Sharing> sharings = (new SharingRepository()).getCascadingPermissionsForEntity(entity.domainId, entity.parentEntityId);
+ List<Sharing> sharings = (new SharingRepository()).getCascadingPermissionsForEntity(entity.getDomainId(), entity.getParentEntityId());
for(Sharing sharing : sharings){
newSharing = new Sharing();
- newSharing.setPermissionTypeId(sharing.permissionTypeId);
- newSharing.setEntityId(entity.entityId);
- newSharing.setGroupId(sharing.groupId);
- newSharing.setInheritedParentId(sharing.inheritedParentId);
+ newSharing.setPermissionTypeId(sharing.getPermissionTypeId());
+ newSharing.setEntityId(entity.getEntityId());
+ newSharing.setGroupId(sharing.getGroupId());
+ newSharing.setInheritedParentId(sharing.getInheritedParentId());
newSharing.setSharingType(SharingType.INDIRECT_CASCADING);
- newSharing.setDomainId(entity.domainId);
+ newSharing.setDomainId(entity.getDomainId());
newSharing.setCreatedTime(System.currentTimeMillis());
newSharing.setUpdatedTime(System.currentTimeMillis());
@@ -853,10 +853,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
}
}
- return entity.entityId;
+ return entity.getEntityId();
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -866,17 +866,17 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
//TODO Check for permission changes
entity.setUpdatedTime(System.currentTimeMillis());
EntityPK entityPK = new EntityPK();
- entityPK.setDomainId(entity.domainId);
- entityPK.setEntityId(entity.entityId);
+ entityPK.setDomainId(entity.getDomainId());
+ entityPK.setEntityId(entity.getEntityId());
Entity oldEntity = (new EntityRepository()).get(entityPK);
- entity.setCreatedTime(oldEntity.createdTime);
+ entity.setCreatedTime(oldEntity.getCreatedTime());
entity = getUpdatedObject(oldEntity, entity);
- entity.setSharedCount((new SharingRepository()).getSharedCount(entity.domainId, entity.entityId));
+ entity.setSharedCount((new SharingRepository()).getSharedCount(entity.getDomainId(), entity.getEntityId()));
(new EntityRepository()).update(entity);
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -894,7 +894,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new EntityRepository()).isExists(entityPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -909,7 +909,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -922,7 +922,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new EntityRepository()).get(entityPK);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -932,11 +932,11 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
try{
List<String> groupIds = new ArrayList<>();
groupIds.add(userId);
- (new GroupMembershipRepository()).getAllParentMembershipsForChild(domainId, userId).stream().forEach(gm -> groupIds.add(gm.parentId));
+ (new GroupMembershipRepository()).getAllParentMembershipsForChild(domainId, userId).stream().forEach(gm -> groupIds.add(gm.getParentId()));
return (new EntityRepository()).searchEntities(domainId, groupIds, filters, offset, limit);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -946,7 +946,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserRepository()).getAccessibleUsers(domainId, entityId, permissionTypeId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -956,7 +956,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return (new UserGroupRepository()).getAccessibleGroups(domainId, entityId, permissionTypeId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -977,7 +977,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return shareEntity(domainId, entityId, userList, permissionTypeId, cascadePermission);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -987,7 +987,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return shareEntity(domainId, entityId, groupList, permissionTypeId, cascadePermission);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -1024,7 +1024,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
(new EntityRepository()).getChildEntities(domainId, entityId).stream().forEach(e -> temp.addLast(e));
while(temp.size() > 0){
Entity entity = temp.pop();
- String childEntityId = entity.entityId;
+ String childEntityId = entity.getEntityId();
for(String userId : groupOrUserList){
Sharing sharing = new Sharing();
sharing.setPermissionTypeId(permissionTypeId);
@@ -1052,7 +1052,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -1065,7 +1065,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return revokeEntitySharing(domainId, entityId, userList, permissionTypeId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -1079,7 +1079,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return revokeEntitySharing(domainId, entityId, groupList, permissionTypeId);
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -1089,13 +1089,13 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
//check whether the user has permission directly or indirectly
List<GroupMembership> parentMemberships = (new GroupMembershipRepository()).getAllParentMembershipsForChild(domainId, userId);
List<String> groupIds = new ArrayList<>();
- parentMemberships.stream().forEach(pm->groupIds.add(pm.parentId));
+ parentMemberships.stream().forEach(pm->groupIds.add(pm.getParentId()));
groupIds.add(userId);
return (new SharingRepository()).hasAccess(domainId, entityId, groupIds, Arrays.asList(permissionTypeId,
(new PermissionTypeRepository()).getOwnerPermissionTypeIdForDomain(domainId)));
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
@@ -1121,7 +1121,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
List<Sharing> temp = new ArrayList<>();
(new SharingRepository()).getIndirectSharedChildren(domainId, entityId, permissionTypeId).stream().forEach(s -> temp.add(s));
for(Sharing sharing : temp){
- String childEntityId = sharing.entityId;
+ String childEntityId = sharing.getEntityId();
for(String groupId : groupOrUserList){
SharingPK sharingPK = new SharingPK();
sharingPK.setEntityId(childEntityId);
@@ -1143,7 +1143,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
return true;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
- throw new SharingRegistryException().setMessage(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
+ throw new SharingRegistryException(ex.getMessage() + " Stack trace:" + ExceptionUtils.getStackTrace(ex));
}
}
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
index 027399e..3234736 100644
--- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
@@ -156,7 +156,7 @@ public class SharingRegistryServiceTest {
sharingServiceClient.createGroup(userGroup1);
userGroup1.setDescription("updated description");
sharingServiceClient.updateGroup(userGroup1);
- Assert.assertTrue(sharingServiceClient.getGroup(domainId, userGroup1.groupId).description.equals("updated description"));
+ Assert.assertTrue(sharingServiceClient.getGroup(domainId, userGroup1.getGroupId()).getDescription().equals("updated description"));
Assert.assertTrue(sharingServiceClient.isGroupExists(domainId, "test-group-1"));
UserGroup userGroup2 = new UserGroup();