http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java index e444c43..00dd367 100644 --- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java +++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/utils/DBConstants.java @@ -29,72 +29,75 @@ public class DBConstants { public static int SELECT_MAX_ROWS = 1000; public static class DomainTable { - public static String DOMAIN_ID = "domainId"; - public static String NAME = "name"; - public static String DESCRIPTION = "description"; + public static final String DOMAIN_ID = "domainId"; + public static final String NAME = "name"; + public static final String DESCRIPTION = "description"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class UserTable { - public static String USER_ID = "userId"; - public static String DOMAIN_ID = "domainId"; - public static String USER_NAME = "userName"; + public static final String USER_ID = "userId"; + public static final String DOMAIN_ID = "domainId"; + public static final String USER_NAME = "userName"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class UserGroupTable { - public static String GROUP_ID = "groupId"; - public static String DOMAIN_ID = "domainId"; - public static String NAME = "name"; - public static String DESCRIPTION = "description"; - public static String OWNER_ID = "ownerId"; - public static String GROUP_TYPE = "groupType"; - public static String GROUP_CARDINALITY = "groupCardinality"; + public static final String GROUP_ID = "groupId"; + public static final String DOMAIN_ID = "domainId"; + public static final String NAME = "name"; + public static final String DESCRIPTION = "description"; + public static final String OWNER_ID = "ownerId"; + public static final String GROUP_TYPE = "groupType"; + public static final String GROUP_CARDINALITY = "groupCardinality"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class GroupMembershipTable { - public static String PARENT_ID = "parentId"; - public static String CHILD_ID = "childId"; - public static String CHILD_TYPE = "childType"; + public static final String PARENT_ID = "parentId"; + public static final String CHILD_ID = "childId"; + public static final String CHILD_TYPE = "childType"; + public static final String DOMAIN_ID = "domainId"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class EntityTypeTable { - public static String ENTITY_TYPE_ID = "entityTypeId"; - public static String DOMAIN_ID = "domainId"; + public static final String ENTITY_TYPE_ID = "entityTypeId"; + public static final String DOMAIN_ID = "domainId"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class PermissionTypeTable { - public static String ENTITY_TYPE_ID = "permissionTypeId"; - public static String DOMAIN_ID = "domainId"; - public static String NAME = "name"; + public static final String ENTITY_TYPE_ID = "permissionTypeId"; + public static final String DOMAIN_ID = "domainId"; + public static final String NAME = "name"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; } public static class EntityTable { - public static String ENTITY_ID = "entityId"; - public static String PARENT_ENTITY_ID = "parentEntityId"; - public static String ENTITY_TYPE_ID = "entityTypeId"; - public static String NAME = "name"; - public static String DESCRIPTION = "description"; - public static String FULL_TEXT = "fullText"; + public static final String ENTITY_ID = "entityId"; + public static final String PARENT_ENTITY_ID = "parentEntityId"; + public static final String ENTITY_TYPE_ID = "entityTypeId"; + public static final String NAME = "name"; + public static final String DESCRIPTION = "description"; + public static final String FULL_TEXT = "fullText"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime"; + public static final String DOMAIN_ID = "domainId"; } public static class SharingTable { - public static String PERMISSION_TYPE_ID = "permissionTypeId"; - public static String ENTITY_ID = "entityId"; - public static String GROUP_ID = "groupId"; - public static String INHERITED_PARENT_ID = "inheritedParentId"; + public static final String DOMAIN_ID = "domainId"; + public static final String PERMISSION_TYPE_ID = "permissionTypeId"; + public static final String ENTITY_ID = "entityId"; + public static final String GROUP_ID = "groupId"; + public static final String INHERITED_PARENT_ID = "inheritedParentId"; public static final String SHARING_TYPE = "sharingType"; public static final String CREATED_TIME = "createdTime"; public static final String UPDATED_TIME = "updatedTime";
http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java ---------------------------------------------------------------------- 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 5757f61..5dc3dbc 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 @@ -21,8 +21,7 @@ package org.apache.airavata.sharing.registry.server; import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.sharing.registry.db.entities.GroupMembershipEntityPK; -import org.apache.airavata.sharing.registry.db.entities.SharingEntityPK; +import org.apache.airavata.sharing.registry.db.entities.*; import org.apache.airavata.sharing.registry.db.repositories.*; import org.apache.airavata.sharing.registry.db.utils.DBConstants; import org.apache.airavata.sharing.registry.db.utils.JPAUtils; @@ -120,7 +119,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac */ @Override public String registerUser(User user) throws SharingRegistryException, TException { - if(userRepository.get(user.userId) != null) + UserPK userPK = new UserPK(); + userPK.setUserId(user.getUserId()); + userPK.setDomainId(user.domainId); + if(userRepository.get(userPK) != null) throw new SharingRegistryException("There exist user with given user id"); user.setCreatedTime(System.currentTimeMillis()); @@ -142,13 +144,19 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac @Override public boolean updatedUser(User user) throws SharingRegistryException, TException { - User oldUser = userRepository.get(user.userId); + UserPK userPK = new UserPK(); + userPK.setUserId(user.userId); + userPK.setDomainId(user.domainId); + User oldUser = userRepository.get(userPK); user.setCreatedTime(oldUser.createdTime); user.setUpdatedTime(System.currentTimeMillis()); user = getUpdatedObject(oldUser, user); userRepository.update(user); - UserGroup userGroup = userGroupRepository.get(user.userId); + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(user.getUserId()); + userGroupPK.setDomainId(user.domainId); + UserGroup userGroup = userGroupRepository.get(userGroupPK); userGroup.setName(user.userName); userGroup.setDescription("user " + user.userName + " group"); updateGroup(userGroup); @@ -156,15 +164,25 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean deleteUser(String userId) throws SharingRegistryException, TException { - userRepository.delete(userId); - userGroupRepository.delete(userId); + public boolean deleteUser(String domainId, String userId) throws SharingRegistryException, TException { + UserPK userPK = new UserPK(); + userPK.setUserId(userId); + userPK.setDomainId(domainId); + userRepository.delete(userPK); + + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(userId); + userGroupPK.setDomainId(domainId); + userGroupRepository.delete(userGroupPK); return true; } @Override - public User getUser(String userId) throws SharingRegistryException, TException { - return userRepository.get(userId); + public User getUser(String domainId, String userId) throws SharingRegistryException, TException { + UserPK userPK = new UserPK(); + userPK.setUserId(userId); + userPK.setDomainId(domainId); + return userRepository.get(userPK); } @Override @@ -180,7 +198,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac */ @Override public String createGroup(UserGroup group) throws SharingRegistryException, TException { - if(userGroupRepository.get(group.groupId) != null) + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(group.groupId); + userGroupPK.setDomainId(group.domainId); + if(userGroupRepository.get(userGroupPK) != null) throw new SharingRegistryException("There exist group with given group id"); group.setCreatedTime(System.currentTimeMillis()); @@ -192,7 +213,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac @Override public boolean updateGroup(UserGroup group) throws SharingRegistryException, TException { group.setUpdatedTime(System.currentTimeMillis()); - UserGroup oldGroup = userGroupRepository.get(group.groupId); + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(group.groupId); + userGroupPK.setDomainId(group.domainId); + UserGroup oldGroup = userGroupRepository.get(userGroupPK); group.setCreatedTime(oldGroup.createdTime); group = getUpdatedObject(oldGroup, group); userGroupRepository.update(group); @@ -200,14 +224,20 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean deleteGroup(String groupId) throws SharingRegistryException, TException { - userGroupRepository.delete(groupId); + public boolean deleteGroup(String domainId, String groupId) throws SharingRegistryException, TException { + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(groupId); + userGroupPK.setDomainId(domainId); + userGroupRepository.delete(userGroupPK); return true; } @Override - public UserGroup getGroup(String groupId) throws SharingRegistryException, TException { - return userGroupRepository.get(groupId); + public UserGroup getGroup(String domainId, String groupId) throws SharingRegistryException, TException { + UserGroupPK userGroupPK = new UserGroupPK(); + userGroupPK.setGroupId(groupId); + userGroupPK.setDomainId(domainId); + return userGroupRepository.get(userGroupPK); } @Override @@ -218,12 +248,13 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean addUsersToGroup(List<String> userIds, String groupId) throws SharingRegistryException, TException { + public boolean addUsersToGroup(String domainId, List<String> userIds, String groupId) throws SharingRegistryException, TException { for(int i=0; i < userIds.size(); i++){ GroupMembership groupMembership = new GroupMembership(); groupMembership.setParentId(groupId); groupMembership.setChildId(userIds.get(i)); groupMembership.setChildType(GroupChildType.USER); + groupMembership.setDomainId(domainId); groupMembership.setCreatedTime(System.currentTimeMillis()); groupMembership.setUpdatedTime(System.currentTimeMillis()); groupMembershipRepository.create(groupMembership); @@ -232,36 +263,40 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean removeUsersFromGroup(List<String> userIds, String groupId) throws SharingRegistryException, TException { + public boolean removeUsersFromGroup(String domainId, List<String> userIds, String groupId) throws SharingRegistryException, TException { for(int i=0; i < userIds.size(); i++){ - GroupMembershipEntityPK groupMembershipEntityPK = new GroupMembershipEntityPK(); - groupMembershipEntityPK.setParentId(groupId); - groupMembershipEntityPK.setChildId(userIds.get(i)); - groupMembershipRepository.delete(groupMembershipEntityPK); + GroupMembershipPK groupMembershipPK = new GroupMembershipPK(); + groupMembershipPK.setParentId(groupId); + groupMembershipPK.setChildId(userIds.get(i)); + groupMembershipPK.setDomainId(domainId); + groupMembershipRepository.delete(groupMembershipPK); } return true; } @Override - public List<User> getGroupMembersOfTypeUser(String groupId, int offset, int limit) throws SharingRegistryException, TException { - List<User> groupMemberUsers = groupMembershipRepository.getAllChildUsers(groupId); + public List<User> getGroupMembersOfTypeUser(String domainId, String groupId, int offset, int limit) throws SharingRegistryException, TException { + //TODO limit offset + List<User> groupMemberUsers = groupMembershipRepository.getAllChildUsers(domainId, groupId); return groupMemberUsers; } @Override - public List<UserGroup> getGroupMembersOfTypeGroup(String groupId, int offset, int limit) throws SharingRegistryException, TException { - List<UserGroup> groupMemberGroups = groupMembershipRepository.getAllChildGroups(groupId); + public List<UserGroup> getGroupMembersOfTypeGroup(String domainId, String groupId, int offset, int limit) throws SharingRegistryException, TException { + //TODO limit offset + List<UserGroup> groupMemberGroups = groupMembershipRepository.getAllChildGroups(domainId, groupId); return groupMemberGroups; } @Override - public boolean addChildGroupsToParentGroup(List<String> childIds, String groupId) throws SharingRegistryException, TException { + public boolean addChildGroupsToParentGroup(String domainId, List<String> childIds, String groupId) throws SharingRegistryException, TException { for(String childId : childIds) { //Todo check for cyclic dependencies GroupMembership groupMembership = new GroupMembership(); groupMembership.setParentId(groupId); groupMembership.setChildId(childId); groupMembership.setChildType(GroupChildType.GROUP); + groupMembership.setDomainId(domainId); groupMembership.setCreatedTime(System.currentTimeMillis()); groupMembership.setUpdatedTime(System.currentTimeMillis()); groupMembershipRepository.create(groupMembership); @@ -270,11 +305,12 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean removeChildGroupFromParentGroup(String childId, String groupId) throws SharingRegistryException, TException { - GroupMembershipEntityPK groupMembershipEntityPK = new GroupMembershipEntityPK(); - groupMembershipEntityPK.setParentId(groupId); - groupMembershipEntityPK.setChildId(childId); - groupMembershipRepository.delete(groupMembershipEntityPK); + public boolean removeChildGroupFromParentGroup(String domainId, String childId, String groupId) throws SharingRegistryException, TException { + GroupMembershipPK groupMembershipPK = new GroupMembershipPK(); + groupMembershipPK.setParentId(groupId); + groupMembershipPK.setChildId(childId); + groupMembershipPK.setDomainId(domainId); + groupMembershipRepository.delete(groupMembershipPK); return true; } @@ -284,7 +320,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac */ @Override public String createEntityType(EntityType entityType) throws SharingRegistryException, TException { - if(entityTypeRepository.get(entityType.entityTypeId) != null) + EntityTypePK entityTypePK = new EntityTypePK(); + entityTypePK.setDomainId(entityType.domainId); + entityTypePK.setEntityTypeId(entityType.entityTypeId); + if(entityTypeRepository.get(entityTypePK) != null) throw new SharingRegistryException("There exist EntityType with given EntityType id"); entityType.setCreatedTime(System.currentTimeMillis()); @@ -296,7 +335,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac @Override public boolean updateEntityType(EntityType entityType) throws SharingRegistryException, TException { entityType.setUpdatedTime(System.currentTimeMillis()); - EntityType oldEntityType = entityTypeRepository.get(entityType.entityTypeId); + EntityTypePK entityTypePK = new EntityTypePK(); + entityTypePK.setDomainId(entityType.domainId); + entityTypePK.setEntityTypeId(entityType.entityTypeId); + EntityType oldEntityType = entityTypeRepository.get(entityTypePK); entityType.setCreatedTime(oldEntityType.createdTime); entityType = getUpdatedObject(oldEntityType, entityType); entityTypeRepository.update(entityType); @@ -304,14 +346,20 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean deleteEntityType(String entityTypeId) throws SharingRegistryException, TException { - entityTypeRepository.delete(entityTypeId); + public boolean deleteEntityType(String domainId, String entityTypeId) throws SharingRegistryException, TException { + EntityTypePK entityTypePK = new EntityTypePK(); + entityTypePK.setDomainId(domainId); + entityTypePK.setEntityTypeId(entityTypeId); + entityTypeRepository.delete(entityTypePK); return true; } @Override - public EntityType getEntityType(String entityTypeId) throws SharingRegistryException, TException { - return entityTypeRepository.get(entityTypeId); + public EntityType getEntityType(String domainId, String entityTypeId) throws SharingRegistryException, TException { + EntityTypePK entityTypePK = new EntityTypePK(); + entityTypePK.setDomainId(domainId); + entityTypePK.setEntityTypeId(entityTypeId); + return entityTypeRepository.get(entityTypePK); } @Override @@ -327,7 +375,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac */ @Override public String createPermissionType(PermissionType permissionType) throws SharingRegistryException, TException { - if(permissionTypeRepository.get(permissionType.permissionTypeId) != null) + PermissionTypePK permissionTypePK = new PermissionTypePK(); + permissionTypePK.setDomainId(permissionType.domainId); + permissionTypePK.setPermissionTypeId(permissionType.permissionTypeId); + if(permissionTypeRepository.get(permissionTypePK) != null) throw new SharingRegistryException("There exist PermissionType with given PermissionType id"); permissionType.setCreatedTime(System.currentTimeMillis()); permissionType.setUpdatedTime(System.currentTimeMillis()); @@ -338,21 +389,30 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac @Override public boolean updatePermissionType(PermissionType permissionType) throws SharingRegistryException, TException { permissionType.setUpdatedTime(System.currentTimeMillis()); - PermissionType oldPermissionType = permissionTypeRepository.get(permissionType.permissionTypeId); + PermissionTypePK permissionTypePK = new PermissionTypePK(); + permissionTypePK.setDomainId(permissionType.domainId); + permissionTypePK.setPermissionTypeId(permissionType.permissionTypeId); + PermissionType oldPermissionType = permissionTypeRepository.get(permissionTypePK); permissionType = getUpdatedObject(oldPermissionType, permissionType); permissionTypeRepository.update(permissionType); return true; } @Override - public boolean deletePermissionType(String entityTypeId) throws SharingRegistryException, TException { - permissionTypeRepository.delete(entityTypeId); + public boolean deletePermissionType(String domainId, String permissionTypeId) throws SharingRegistryException, TException { + PermissionTypePK permissionTypePK = new PermissionTypePK(); + permissionTypePK.setDomainId(domainId); + permissionTypePK.setPermissionTypeId(permissionTypeId); + permissionTypeRepository.delete(permissionTypePK); return true; } @Override - public PermissionType getPermissionType(String permissionTypeId) throws SharingRegistryException, TException { - return permissionTypeRepository.get(permissionTypeId); + public PermissionType getPermissionType(String domainId, String permissionTypeId) throws SharingRegistryException, TException { + PermissionTypePK permissionTypePK = new PermissionTypePK(); + permissionTypePK.setDomainId(domainId); + permissionTypePK.setPermissionTypeId(permissionTypeId); + return permissionTypeRepository.get(permissionTypePK); } @Override @@ -368,10 +428,17 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac */ @Override public String registerEntity(Entity entity) throws SharingRegistryException, TException { - if(entityRepository.get(entity.entityId) != null) + EntityPK entityPK = new EntityPK(); + entityPK.setDomainId(entity.domainId); + entityPK.setEntityId(entity.entityId); + if(entityRepository.get(entityPK) != null) throw new SharingRegistryException("There exist Entity with given Entity id"); - if(!userRepository.isExists(entity.getOwnerId())){ + UserPK userPK = new UserPK(); + userPK.setDomainId(entity.domainId); + userPK.setUserId(entity.ownerId); + if(!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); @@ -391,6 +458,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac newSharing.setGroupId(entity.ownerId); newSharing.setSharingType(SharingType.DIRECT_CASCADING); newSharing.setInheritedParentId(entity.entityId); + newSharing.setDomainId(entity.domainId); newSharing.setCreatedTime(System.currentTimeMillis()); newSharing.setUpdatedTime(System.currentTimeMillis()); @@ -398,7 +466,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac //creating records for inherited permissions if(entity.getParentEntityId() != null && entity.getParentEntityId() != ""){ - List<Sharing> sharings = sharingRepository.getCascadingPermissionsForEntity(entity.parentEntityId); + List<Sharing> sharings = sharingRepository.getCascadingPermissionsForEntity(entity.domainId, entity.parentEntityId); for(Sharing sharing : sharings){ newSharing = new Sharing(); newSharing.setPermissionTypeId(sharing.permissionTypeId); @@ -406,6 +474,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac newSharing.setGroupId(sharing.groupId); newSharing.setInheritedParentId(sharing.inheritedParentId); newSharing.setSharingType(SharingType.INDIRECT_CASCADING); + newSharing.setDomainId(entity.domainId); newSharing.setCreatedTime(System.currentTimeMillis()); newSharing.setUpdatedTime(System.currentTimeMillis()); @@ -420,7 +489,10 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac public boolean updateEntity(Entity entity) throws SharingRegistryException, TException { //TODO Check for permission changes entity.setUpdatedTime(System.currentTimeMillis()); - Entity oldEntity = entityRepository.get(entity.getEntityId()); + EntityPK entityPK = new EntityPK(); + entityPK.setDomainId(entity.domainId); + entityPK.setEntityId(entity.entityId); + Entity oldEntity = entityRepository.get(entityPK); entity.setCreatedTime(oldEntity.createdTime); entity = getUpdatedObject(oldEntity, entity); entityRepository.update(entity); @@ -428,34 +500,40 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac } @Override - public boolean deleteEntity(String entityId) throws SharingRegistryException, TException { + public boolean deleteEntity(String domainId, String entityId) throws SharingRegistryException, TException { //TODO Check for permission changes - entityRepository.delete(entityId); + EntityPK entityPK = new EntityPK(); + entityPK.setDomainId(domainId); + entityPK.setEntityId(entityId); + entityRepository.delete(entityPK); return true; } @Override - public Entity getEntity(String entityId) throws SharingRegistryException, TException { - return entityRepository.get(entityId); + public Entity getEntity(String domainId, String entityId) throws SharingRegistryException, TException { + EntityPK entityPK = new EntityPK(); + entityPK.setDomainId(domainId); + entityPK.setEntityId(entityId); + return entityRepository.get(entityPK); } @Override - public List<Entity> searchEntities(String userId, String entityTypeId, List<SearchCriteria> filters, + public List<Entity> searchEntities(String domainId, String userId, String entityTypeId, List<SearchCriteria> filters, int offset, int limit) throws SharingRegistryException, TException { List<String> groupIds = new ArrayList<>(); groupIds.add(userId); - groupMembershipRepository.getAllParentMembershipsForChild(userId).stream().forEach(gm->groupIds.add(gm.parentId)); - return entityRepository.searchEntities(groupIds, entityTypeId, filters, offset, limit); + groupMembershipRepository.getAllParentMembershipsForChild(domainId, userId).stream().forEach(gm->groupIds.add(gm.parentId)); + return entityRepository.searchEntities(domainId, groupIds, entityTypeId, filters, offset, limit); } @Override - public List<User> getListOfSharedUsers(String entityId, String permissionTypeId) throws SharingRegistryException, TException { - return userRepository.getAccessibleUsers(entityId, permissionTypeId); + public List<User> getListOfSharedUsers(String domainId, String entityId, String permissionTypeId) throws SharingRegistryException, TException { + return userRepository.getAccessibleUsers(domainId, entityId, permissionTypeId); } @Override - public List<UserGroup> getListOfSharedGroups(String entityId, String permissionTypeId) throws SharingRegistryException, TException { - return userGroupRepository.getAccessibleGroups(entityId, permissionTypeId); + public List<UserGroup> getListOfSharedGroups(String domainId, String entityId, String permissionTypeId) throws SharingRegistryException, TException { + return userGroupRepository.getAccessibleGroups(domainId, entityId, permissionTypeId); } /** @@ -489,6 +567,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac sharing.setEntityId(entityId); sharing.setGroupId(userId); sharing.setInheritedParentId(entityId); + sharing.setDomainId(domainId); if(cascadePermission) { sharing.setSharingType(SharingType.DIRECT_CASCADING); }else { @@ -514,6 +593,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac sharing.setInheritedParentId(entityId); sharing.setSharingType(SharingType.INDIRECT_CASCADING); sharing.setInheritedParentId(entityId); + sharing.setDomainId(domainId); sharing.setCreatedTime(System.currentTimeMillis()); sharing.setUpdatedTime(System.currentTimeMillis()); sharingRepository.create(sharing); @@ -538,11 +618,11 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac @Override public boolean userHasAccess(String domainId, String userId, String entityId, String permissionTypeId) throws SharingRegistryException, TException { //check whether the user has permission directly or indirectly - List<GroupMembership> parentMemberships = groupMembershipRepository.getAllParentMembershipsForChild(userId); + List<GroupMembership> parentMemberships = groupMembershipRepository.getAllParentMembershipsForChild(domainId, userId); List<String> groupIds = new ArrayList<>(); parentMemberships.stream().forEach(pm->groupIds.add(pm.parentId)); groupIds.add(userId); - return sharingRepository.hasAccess(entityId, groupIds, Arrays.asList(permissionTypeId, + return sharingRepository.hasAccess(domainId, entityId, groupIds, Arrays.asList(permissionTypeId, permissionTypeRepository.getGlobalPermissionTypeIdForDomain(domainId))); } @@ -553,28 +633,30 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac //revoking permission for the entity for(String groupId : groupOrUserList){ - SharingEntityPK sharingEntityPK = new SharingEntityPK(); - sharingEntityPK.setEntityId(entityId); - sharingEntityPK.setGroupId(groupId); - sharingEntityPK.setPermissionTypeId(permissionTypeId); - sharingEntityPK.setInheritedParentId(entityId); - - sharingRepository.delete(sharingEntityPK); + SharingPK sharingPK = new SharingPK(); + sharingPK.setEntityId(entityId); + sharingPK.setGroupId(groupId); + sharingPK.setPermissionTypeId(permissionTypeId); + sharingPK.setInheritedParentId(entityId); + sharingPK.setDomainId(domainId); + + sharingRepository.delete(sharingPK); } //revoking permission from inheritance List<Sharing> temp = new ArrayList<>(); - sharingRepository.getIndirectSharedChildren(entityId, permissionTypeId).stream().forEach(s->temp.add(s)); + sharingRepository.getIndirectSharedChildren(domainId, entityId, permissionTypeId).stream().forEach(s->temp.add(s)); for(Sharing sharing : temp){ String childEntityId = sharing.entityId; for(String groupId : groupOrUserList){ - SharingEntityPK sharingEntityPK = new SharingEntityPK(); - sharingEntityPK.setEntityId(childEntityId); - sharingEntityPK.setGroupId(groupId); - sharingEntityPK.setPermissionTypeId(permissionTypeId); - sharingEntityPK.setInheritedParentId(entityId); - - sharingRepository.delete(sharingEntityPK); + SharingPK sharingPK = new SharingPK(); + sharingPK.setEntityId(childEntityId); + sharingPK.setGroupId(groupId); + sharingPK.setPermissionTypeId(permissionTypeId); + sharingPK.setInheritedParentId(entityId); + sharingPK.setDomainId(domainId); + + sharingRepository.delete(sharingPK); } } return true; http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/META-INF/persistence.xml b/modules/sharing-registry/sharing-registry-server/src/main/resources/META-INF/persistence.xml index 7b08528..a9f808c 100644 --- a/modules/sharing-registry/sharing-registry-server/src/main/resources/META-INF/persistence.xml +++ b/modules/sharing-registry/sharing-registry-server/src/main/resources/META-INF/persistence.xml @@ -9,7 +9,7 @@ <class>org.apache.airavata.sharing.registry.db.entities.GroupMembershipEntity</class> <class>org.apache.airavata.sharing.registry.db.entities.PermissionTypeEntity</class> <class>org.apache.airavata.sharing.registry.db.entities.SharingEntity</class> - <class>org.apache.airavata.sharing.registry.db.entities.SharingUserEntity</class> + <class>org.apache.airavata.sharing.registry.db.entities.UserEntity</class> <class>org.apache.airavata.sharing.registry.db.entities.UserGroupEntity</class> </persistence-unit> </persistence> http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql index e1937fd..0b5167a 100644 --- a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql +++ b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-derby.sql @@ -38,7 +38,7 @@ CREATE TABLE SHARING_USER ( ICON BLOB, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (USER_ID), + PRIMARY KEY (USER_ID, DOMAIN_ID), FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); @@ -52,21 +52,21 @@ CREATE TABLE USER_GROUP ( GROUP_CARDINALITY VARCHAR(255) NOT NULL, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (GROUP_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (OWNER_ID) REFERENCES SHARING_USER(USER_ID) ON DELETE CASCADE ON UPDATE NO ACTION + PRIMARY KEY (GROUP_ID, DOMAIN_ID), + FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE GROUP_MEMBERSHIP ( PARENT_ID VARCHAR(255) NOT NULL, CHILD_ID VARCHAR(255) NOT NULL, + DOMAIN_ID VARCHAR(255) NOT NULL, CHILD_TYPE VARCHAR(255) NOT NULL, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PARENT_ID, CHILD_ID), - FOREIGN KEY (PARENT_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (CHILD_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE NO ACTION + PRIMARY KEY (PARENT_ID, CHILD_ID, DOMAIN_ID), + FOREIGN KEY (PARENT_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (CHILD_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE ENTITY_TYPE ( @@ -76,7 +76,7 @@ CREATE TABLE ENTITY_TYPE ( DESCRIPTION VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_TYPE_ID), + PRIMARY KEY (ENTITY_TYPE_ID, DOMAIN_ID), FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); @@ -87,7 +87,7 @@ CREATE TABLE PERMISSION_TYPE ( DESCRIPTION VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID), + PRIMARY KEY (PERMISSION_TYPE_ID, DOMAIN_ID), FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); @@ -99,38 +99,31 @@ CREATE TABLE ENTITY ( PARENT_ENTITY_ID VARCHAR(255), NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), + BINARY_DATA BLOB, FULL_TEXT CLOB, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (ENTITY_TYPE_ID) REFERENCES ENTITY_TYPE(ENTITY_TYPE_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (OWNER_ID) REFERENCES SHARING_USER(USER_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (PARENT_ENTITY_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE NO ACTION + PRIMARY KEY (ENTITY_ID, DOMAIN_ID), + FOREIGN KEY (ENTITY_TYPE_ID, DOMAIN_ID) REFERENCES ENTITY_TYPE(ENTITY_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (PARENT_ENTITY_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); -- ALTER TABLE ENTITY ADD FULLTEXT FULL_TEXT_INDEX(FULL_TEXT); -CREATE TABLE ENTITY_METADATA ( - ENTITY_ID VARCHAR (255) NOT NULL, - META_KEY VARCHAR (255) NOT NULL, - META_VALUE VARCHAR (255) NOT NULL, - PRIMARY KEY (ENTITY_ID, META_KEY), - FOREIGN KEY (ENTITY_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE NO ACTION -); - CREATE TABLE SHARING ( PERMISSION_TYPE_ID VARCHAR(255) NOT NULL, ENTITY_ID VARCHAR(255) NOT NULL, + DOMAIN_ID VARCHAR (255) NOT NULL, GROUP_ID VARCHAR(255) NOT NULL, SHARING_TYPE VARCHAR(255) NOT NULL, INHERITED_PARENT_ID VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID, INHERITED_PARENT_ID), - FOREIGN KEY (PERMISSION_TYPE_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (INHERITED_PARENT_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE NO ACTION, - FOREIGN KEY (GROUP_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE NO ACTION + PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID, DOMAIN_ID, INHERITED_PARENT_ID), + FOREIGN KEY (PERMISSION_TYPE_ID, DOMAIN_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (INHERITED_PARENT_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (GROUP_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE CONFIGURATION http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql index 675fad3..ce7a9bf 100644 --- a/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql +++ b/modules/sharing-registry/sharing-registry-server/src/main/resources/sharing-registry-mysql.sql @@ -38,8 +38,8 @@ CREATE TABLE SHARING_USER ( ICON BLOB, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (USER_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (USER_ID, DOMAIN_ID), + FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE USER_GROUP ( @@ -52,21 +52,21 @@ CREATE TABLE USER_GROUP ( GROUP_CARDINALITY VARCHAR(255) NOT NULL, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (GROUP_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (OWNER_ID) REFERENCES SHARING_USER(USER_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (GROUP_ID, DOMAIN_ID), + FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE GROUP_MEMBERSHIP ( PARENT_ID VARCHAR(255) NOT NULL, CHILD_ID VARCHAR(255) NOT NULL, + DOMAIN_ID VARCHAR(255) NOT NULL, CHILD_TYPE VARCHAR(255) NOT NULL, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PARENT_ID, CHILD_ID), - FOREIGN KEY (PARENT_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (CHILD_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (PARENT_ID, CHILD_ID, DOMAIN_ID), + FOREIGN KEY (PARENT_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (CHILD_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE ENTITY_TYPE ( @@ -76,8 +76,8 @@ CREATE TABLE ENTITY_TYPE ( DESCRIPTION VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_TYPE_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (ENTITY_TYPE_ID, DOMAIN_ID), + FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE PERMISSION_TYPE ( @@ -87,8 +87,8 @@ CREATE TABLE PERMISSION_TYPE ( DESCRIPTION VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (PERMISSION_TYPE_ID, DOMAIN_ID), + FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE ENTITY ( @@ -99,38 +99,31 @@ CREATE TABLE ENTITY ( PARENT_ENTITY_ID VARCHAR(255), NAME VARCHAR(255) NOT NULL, DESCRIPTION VARCHAR(255), + BINARY_DATA BLOB, FULL_TEXT TEXT, CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (ENTITY_ID), - FOREIGN KEY (DOMAIN_ID) REFERENCES DOMAIN(DOMAIN_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (ENTITY_TYPE_ID) REFERENCES ENTITY_TYPE(ENTITY_TYPE_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (OWNER_ID) REFERENCES SHARING_USER(USER_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (PARENT_ENTITY_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (ENTITY_ID, DOMAIN_ID), + FOREIGN KEY (ENTITY_TYPE_ID, DOMAIN_ID) REFERENCES ENTITY_TYPE(ENTITY_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (OWNER_ID, DOMAIN_ID) REFERENCES SHARING_USER(USER_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (PARENT_ENTITY_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); ALTER TABLE ENTITY ADD FULLTEXT FULL_TEXT_INDEX(FULL_TEXT); -CREATE TABLE ENTITY_METADATA ( - ENTITY_ID VARCHAR (255) NOT NULL, - META_KEY VARCHAR (255) NOT NULL, - META_VALUE VARCHAR (255) NOT NULL, - PRIMARY KEY (ENTITY_ID, META_KEY), - FOREIGN KEY (ENTITY_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE CASCADE -); - CREATE TABLE SHARING ( PERMISSION_TYPE_ID VARCHAR(255) NOT NULL, ENTITY_ID VARCHAR(255) NOT NULL, + DOMAIN_ID VARCHAR (255) NOT NULL, GROUP_ID VARCHAR(255) NOT NULL, SHARING_TYPE VARCHAR(255) NOT NULL, INHERITED_PARENT_ID VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, - PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID, INHERITED_PARENT_ID), - FOREIGN KEY (PERMISSION_TYPE_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (INHERITED_PARENT_ID) REFERENCES ENTITY(ENTITY_ID) ON DELETE CASCADE ON UPDATE CASCADE, - FOREIGN KEY (GROUP_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE + PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID, DOMAIN_ID, INHERITED_PARENT_ID), + FOREIGN KEY (PERMISSION_TYPE_ID, DOMAIN_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (INHERITED_PARENT_ID, DOMAIN_ID) REFERENCES ENTITY(ENTITY_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION, + FOREIGN KEY (GROUP_ID, DOMAIN_ID) REFERENCES USER_GROUP(GROUP_ID, DOMAIN_ID) ON DELETE CASCADE ON UPDATE NO ACTION ); CREATE TABLE CONFIGURATION http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java index df0dcba..499fc88 100644 --- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java +++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java @@ -34,8 +34,6 @@ import org.slf4j.LoggerFactory; import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; public class SharingRegistryServerHandlerTest { private final static Logger logger = LoggerFactory.getLogger(SharingRegistryServerHandlerTest.class); @@ -130,12 +128,12 @@ public class SharingRegistryServerHandlerTest { Assert.assertNotNull(sharingRegistryServerHandler.createGroup(userGroup2)); - sharingRegistryServerHandler.addUsersToGroup(Arrays.asList(userId1), groupId1); - sharingRegistryServerHandler.addUsersToGroup(Arrays.asList(userId2, userId3), groupId2); - sharingRegistryServerHandler.addChildGroupsToParentGroup(Arrays.asList(groupId2), groupId1); + sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId1), groupId1); + sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId2, userId3), groupId2); + sharingRegistryServerHandler.addChildGroupsToParentGroup(domainId, Arrays.asList(groupId2), groupId1); - Assert.assertTrue(sharingRegistryServerHandler.getGroupMembersOfTypeGroup(groupId1, 0, 10).size() == 1); - Assert.assertTrue(sharingRegistryServerHandler.getGroupMembersOfTypeUser(groupId2, 0, 10).size() == 2); + Assert.assertTrue(sharingRegistryServerHandler.getGroupMembersOfTypeGroup(domainId, groupId1, 0, 10).size() == 1); + Assert.assertTrue(sharingRegistryServerHandler.getGroupMembersOfTypeUser(domainId, groupId2, 0, 10).size() == 2); //Creating permission types @@ -203,9 +201,6 @@ public class SharingRegistryServerHandlerTest { entity1.setOwnerId(userId1); entity1.setName("Project name 1"); entity1.setDescription("Project description"); - Map<String, String> metadataMap = new HashMap<>(); - metadataMap.put("key", "val"); - entity1.setMetadata(metadataMap); entity1.setFullText("Project name project description"); entity1.setCreatedTime(System.currentTimeMillis()); entity1.setUpdatedTime(System.currentTimeMillis()); @@ -221,9 +216,6 @@ public class SharingRegistryServerHandlerTest { entity2.setName("Experiment name"); entity2.setDescription("Experiment description"); entity2.setParentEntityId(entityId1); - metadataMap = new HashMap<>(); - metadataMap.put("key", "val"); - entity2.setMetadata(metadataMap); entity2.setFullText("Project name project description"); entity2.setCreatedTime(System.currentTimeMillis()); entity2.setUpdatedTime(System.currentTimeMillis()); @@ -239,9 +231,6 @@ public class SharingRegistryServerHandlerTest { entity3.setName("Experiment name"); entity3.setDescription("Experiment description"); entity3.setParentEntityId(entityId1); - metadataMap = new HashMap<>(); - metadataMap.put("key", "val"); - entity3.setMetadata(metadataMap); entity3.setFullText("Project name project description"); entity3.setCreatedTime(System.currentTimeMillis()); entity3.setUpdatedTime(System.currentTimeMillis()); @@ -260,9 +249,6 @@ public class SharingRegistryServerHandlerTest { entity4.setName("Input name"); entity4.setDescription("Input file description"); entity4.setParentEntityId(entityId3); - metadataMap = new HashMap<>(); - metadataMap.put("key", "val"); - entity4.setMetadata(metadataMap); entity4.setFullText("Input File"); entity4.setCreatedTime(System.currentTimeMillis()); entity4.setUpdatedTime(System.currentTimeMillis()); @@ -281,10 +267,10 @@ public class SharingRegistryServerHandlerTest { searchCriteria.setValue("Input"); searchCriteria.setSearchField(EntitySearchField.NAME); filters.add(searchCriteria); - Assert.assertTrue(sharingRegistryServerHandler.searchEntities(userId1, entityTypeId3, filters, 0, -1).size() > 0); + Assert.assertTrue(sharingRegistryServerHandler.searchEntities(domainId, userId1, entityTypeId3, filters, 0, -1).size() > 0); - Assert.assertNotNull(sharingRegistryServerHandler.getListOfSharedUsers(entityId1, permissionTypeId1)); - Assert.assertNotNull(sharingRegistryServerHandler.getListOfSharedGroups(entityId1, permissionTypeId1)); + Assert.assertNotNull(sharingRegistryServerHandler.getListOfSharedUsers(domainId, entityId1, permissionTypeId1)); + Assert.assertNotNull(sharingRegistryServerHandler.getListOfSharedGroups(domainId, entityId1, permissionTypeId1)); // sharingRegistryServerHandler.revokeEntitySharingFromUsers(entityId1, Arrays.asList(userId2), permissionTypeId1); // sharingRegistryServerHandler.revokeEntitySharingFromGroups(entityId3, Arrays.asList(groupId2), permissionTypeId1); http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Domain.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Domain.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Domain.java index f7ea565..4d1f544 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Domain.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Domain.java @@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory; * <li>updatedTime : Will be set by the system</li> * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-14") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-16") public class Domain implements org.apache.thrift.TBase<Domain, Domain._Fields>, java.io.Serializable, Cloneable, Comparable<Domain> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Domain"); http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java index 81aaf90..f1ae4b8 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Entity.java @@ -36,20 +36,20 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) /** * <p>Entity object which is used to register an entity in the system.</p> - * <li><b>entityId</b> : Client id provided by the client</li> + * <li><b>entityId</b> : Entity id provided by the client</li> * <li><b>domainId</b> : Domain id</li> * <li><b>entityTypeId</b> : Entity type id</li> * <li><b>ownerId</b> : Owner id</li> * <li>parentEntityId : Parent entity id</li> * <li><b>name</b> : Name</li> * <li>description : Short description for the entity</li> - * <li>metadata : Map of optional metadata</li> + * <li>binaryData : Any information stored in binary format</li> * <li>fullText : A string which will be considered for full text search</li> * <li>createdTime : If client provides this value then the system will use it if not the current time will be set</li> * <li>updatedTime : If client provides this value then the system will use it if not the current time will be set</li> * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-14") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-16") public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, java.io.Serializable, Cloneable, Comparable<Entity> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Entity"); @@ -60,7 +60,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, private static final org.apache.thrift.protocol.TField PARENT_ENTITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("parentEntityId", org.apache.thrift.protocol.TType.STRING, (short)5); private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)6); private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)7); - private static final org.apache.thrift.protocol.TField METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("metadata", org.apache.thrift.protocol.TType.MAP, (short)8); + private static final org.apache.thrift.protocol.TField BINARY_DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryData", org.apache.thrift.protocol.TType.STRING, (short)8); private static final org.apache.thrift.protocol.TField FULL_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("fullText", org.apache.thrift.protocol.TType.STRING, (short)9); private static final org.apache.thrift.protocol.TField CREATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createdTime", org.apache.thrift.protocol.TType.I64, (short)10); private static final org.apache.thrift.protocol.TField UPDATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedTime", org.apache.thrift.protocol.TType.I64, (short)11); @@ -78,7 +78,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, public String parentEntityId; // optional public String name; // optional public String description; // optional - public Map<String,String> metadata; // optional + public ByteBuffer binaryData; // optional public String fullText; // optional public long createdTime; // optional public long updatedTime; // optional @@ -92,7 +92,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, PARENT_ENTITY_ID((short)5, "parentEntityId"), NAME((short)6, "name"), DESCRIPTION((short)7, "description"), - METADATA((short)8, "metadata"), + BINARY_DATA((short)8, "binaryData"), FULL_TEXT((short)9, "fullText"), CREATED_TIME((short)10, "createdTime"), UPDATED_TIME((short)11, "updatedTime"); @@ -124,8 +124,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, return NAME; case 7: // DESCRIPTION return DESCRIPTION; - case 8: // METADATA - return METADATA; + case 8: // BINARY_DATA + return BINARY_DATA; case 9: // FULL_TEXT return FULL_TEXT; case 10: // CREATED_TIME @@ -175,7 +175,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, private static final int __CREATEDTIME_ISSET_ID = 0; private static final int __UPDATEDTIME_ISSET_ID = 1; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.ENTITY_ID,_Fields.DOMAIN_ID,_Fields.ENTITY_TYPE_ID,_Fields.OWNER_ID,_Fields.PARENT_ENTITY_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.METADATA,_Fields.FULL_TEXT,_Fields.CREATED_TIME,_Fields.UPDATED_TIME}; + private static final _Fields optionals[] = {_Fields.ENTITY_ID,_Fields.DOMAIN_ID,_Fields.ENTITY_TYPE_ID,_Fields.OWNER_ID,_Fields.PARENT_ENTITY_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.BINARY_DATA,_Fields.FULL_TEXT,_Fields.CREATED_TIME,_Fields.UPDATED_TIME}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -193,10 +193,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.METADATA, new org.apache.thrift.meta_data.FieldMetaData("metadata", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + tmpMap.put(_Fields.BINARY_DATA, new org.apache.thrift.meta_data.FieldMetaData("binaryData", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.FULL_TEXT, new org.apache.thrift.meta_data.FieldMetaData("fullText", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.CREATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("createdTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, @@ -236,9 +234,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, if (other.isSetDescription()) { this.description = other.description; } - if (other.isSetMetadata()) { - Map<String,String> __this__metadata = new HashMap<String,String>(other.metadata); - this.metadata = __this__metadata; + if (other.isSetBinaryData()) { + this.binaryData = org.apache.thrift.TBaseHelper.copyBinary(other.binaryData); } if (other.isSetFullText()) { this.fullText = other.fullText; @@ -260,7 +257,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, this.parentEntityId = null; this.name = null; this.description = null; - this.metadata = null; + this.binaryData = null; this.fullText = null; setCreatedTimeIsSet(false); this.createdTime = 0; @@ -436,38 +433,37 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, } } - public int getMetadataSize() { - return (this.metadata == null) ? 0 : this.metadata.size(); + public byte[] getBinaryData() { + setBinaryData(org.apache.thrift.TBaseHelper.rightSize(binaryData)); + return binaryData == null ? null : binaryData.array(); } - public void putToMetadata(String key, String val) { - if (this.metadata == null) { - this.metadata = new HashMap<String,String>(); - } - this.metadata.put(key, val); + public ByteBuffer bufferForBinaryData() { + return org.apache.thrift.TBaseHelper.copyBinary(binaryData); } - public Map<String,String> getMetadata() { - return this.metadata; + public Entity setBinaryData(byte[] binaryData) { + this.binaryData = binaryData == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(binaryData, binaryData.length)); + return this; } - public Entity setMetadata(Map<String,String> metadata) { - this.metadata = metadata; + public Entity setBinaryData(ByteBuffer binaryData) { + this.binaryData = org.apache.thrift.TBaseHelper.copyBinary(binaryData); return this; } - public void unsetMetadata() { - this.metadata = null; + public void unsetBinaryData() { + this.binaryData = null; } - /** Returns true if field metadata is set (has been assigned a value) and false otherwise */ - public boolean isSetMetadata() { - return this.metadata != null; + /** Returns true if field binaryData is set (has been assigned a value) and false otherwise */ + public boolean isSetBinaryData() { + return this.binaryData != null; } - public void setMetadataIsSet(boolean value) { + public void setBinaryDataIsSet(boolean value) { if (!value) { - this.metadata = null; + this.binaryData = null; } } @@ -599,11 +595,11 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, } break; - case METADATA: + case BINARY_DATA: if (value == null) { - unsetMetadata(); + unsetBinaryData(); } else { - setMetadata((Map<String,String>)value); + setBinaryData((ByteBuffer)value); } break; @@ -657,8 +653,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, case DESCRIPTION: return getDescription(); - case METADATA: - return getMetadata(); + case BINARY_DATA: + return getBinaryData(); case FULL_TEXT: return getFullText(); @@ -694,8 +690,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, return isSetName(); case DESCRIPTION: return isSetDescription(); - case METADATA: - return isSetMetadata(); + case BINARY_DATA: + return isSetBinaryData(); case FULL_TEXT: return isSetFullText(); case CREATED_TIME: @@ -782,12 +778,12 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, return false; } - boolean this_present_metadata = true && this.isSetMetadata(); - boolean that_present_metadata = true && that.isSetMetadata(); - if (this_present_metadata || that_present_metadata) { - if (!(this_present_metadata && that_present_metadata)) + boolean this_present_binaryData = true && this.isSetBinaryData(); + boolean that_present_binaryData = true && that.isSetBinaryData(); + if (this_present_binaryData || that_present_binaryData) { + if (!(this_present_binaryData && that_present_binaryData)) return false; - if (!this.metadata.equals(that.metadata)) + if (!this.binaryData.equals(that.binaryData)) return false; } @@ -860,10 +856,10 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, if (present_description) list.add(description); - boolean present_metadata = true && (isSetMetadata()); - list.add(present_metadata); - if (present_metadata) - list.add(metadata); + boolean present_binaryData = true && (isSetBinaryData()); + list.add(present_binaryData); + if (present_binaryData) + list.add(binaryData); boolean present_fullText = true && (isSetFullText()); list.add(present_fullText); @@ -961,12 +957,12 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, return lastComparison; } } - lastComparison = Boolean.valueOf(isSetMetadata()).compareTo(other.isSetMetadata()); + lastComparison = Boolean.valueOf(isSetBinaryData()).compareTo(other.isSetBinaryData()); if (lastComparison != 0) { return lastComparison; } - if (isSetMetadata()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metadata, other.metadata); + if (isSetBinaryData()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.binaryData, other.binaryData); if (lastComparison != 0) { return lastComparison; } @@ -1090,13 +1086,13 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, } first = false; } - if (isSetMetadata()) { + if (isSetBinaryData()) { if (!first) sb.append(", "); - sb.append("metadata:"); - if (this.metadata == null) { + sb.append("binaryData:"); + if (this.binaryData == null) { sb.append("null"); } else { - sb.append(this.metadata); + org.apache.thrift.TBaseHelper.toString(this.binaryData, sb); } first = false; } @@ -1223,22 +1219,10 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 8: // METADATA - if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); - struct.metadata = new HashMap<String,String>(2*_map0.size); - String _key1; - String _val2; - for (int _i3 = 0; _i3 < _map0.size; ++_i3) - { - _key1 = iprot.readString(); - _val2 = iprot.readString(); - struct.metadata.put(_key1, _val2); - } - iprot.readMapEnd(); - } - struct.setMetadataIsSet(true); + case 8: // BINARY_DATA + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.binaryData = iprot.readBinary(); + struct.setBinaryDataIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1331,18 +1315,10 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, oprot.writeFieldEnd(); } } - if (struct.metadata != null) { - if (struct.isSetMetadata()) { - oprot.writeFieldBegin(METADATA_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.metadata.size())); - for (Map.Entry<String, String> _iter4 : struct.metadata.entrySet()) - { - oprot.writeString(_iter4.getKey()); - oprot.writeString(_iter4.getValue()); - } - oprot.writeMapEnd(); - } + if (struct.binaryData != null) { + if (struct.isSetBinaryData()) { + oprot.writeFieldBegin(BINARY_DATA_FIELD_DESC); + oprot.writeBinary(struct.binaryData); oprot.writeFieldEnd(); } } @@ -1402,7 +1378,7 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, if (struct.isSetDescription()) { optionals.set(6); } - if (struct.isSetMetadata()) { + if (struct.isSetBinaryData()) { optionals.set(7); } if (struct.isSetFullText()) { @@ -1436,15 +1412,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, if (struct.isSetDescription()) { oprot.writeString(struct.description); } - if (struct.isSetMetadata()) { - { - oprot.writeI32(struct.metadata.size()); - for (Map.Entry<String, String> _iter5 : struct.metadata.entrySet()) - { - oprot.writeString(_iter5.getKey()); - oprot.writeString(_iter5.getValue()); - } - } + if (struct.isSetBinaryData()) { + oprot.writeBinary(struct.binaryData); } if (struct.isSetFullText()) { oprot.writeString(struct.fullText); @@ -1490,19 +1459,8 @@ public class Entity implements org.apache.thrift.TBase<Entity, Entity._Fields>, struct.setDescriptionIsSet(true); } if (incoming.get(7)) { - { - org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.metadata = new HashMap<String,String>(2*_map6.size); - String _key7; - String _val8; - for (int _i9 = 0; _i9 < _map6.size; ++_i9) - { - _key7 = iprot.readString(); - _val8 = iprot.readString(); - struct.metadata.put(_key7, _val8); - } - } - struct.setMetadataIsSet(true); + struct.binaryData = iprot.readBinary(); + struct.setBinaryDataIsSet(true); } if (incoming.get(8)) { struct.fullText = iprot.readString(); http://git-wip-us.apache.org/repos/asf/airavata/blob/b6e07d7b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntityType.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntityType.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntityType.java index 50d52de..2195848 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntityType.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntityType.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) /** * <p>client defined entity types</p> - * <li>entityTypeId : System generated entity type id. In the current implementation it will of the form domainId:name</li> + * <li><b>entityTypeId</b> : Entity type id provided by the client</li> * <li><b>domainId</b> : Domain id of the domain.</li> * <li><b>name</b> : Name for the entity type. Should be a single word.</li> * <li>description : Short description for the entity type.</li> @@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory; * <li>updatedTime : Will be set by the system</li> * */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-14") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-16") public class EntityType implements org.apache.thrift.TBase<EntityType, EntityType._Fields>, java.io.Serializable, Cloneable, Comparable<EntityType> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("EntityType"); @@ -166,8 +166,6 @@ public class EntityType implements org.apache.thrift.TBase<EntityType, EntityTyp } public EntityType() { - this.entityTypeId = "DO_NOT_SET_AT_CLIENTS_ID"; - } /** @@ -197,8 +195,7 @@ public class EntityType implements org.apache.thrift.TBase<EntityType, EntityTyp @Override public void clear() { - this.entityTypeId = "DO_NOT_SET_AT_CLIENTS_ID"; - + this.entityTypeId = null; this.domainId = null; this.name = null; this.description = null;