WIP
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a99f7661 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a99f7661 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a99f7661 Branch: refs/heads/airavata-gov-registry Commit: a99f76612721c7c739a4ba2699844eda1cb32354 Parents: 99de5cc Author: scnakandala <[email protected]> Authored: Mon Oct 3 18:23:42 2016 -0400 Committer: scnakandala <[email protected]> Committed: Mon Oct 3 18:23:42 2016 -0400 ---------------------------------------------------------------------- .../registry/db/entities/SharingEntity.java | 33 + .../server/GovRegistryServerHandler.java | 28 + .../src/main/resources/gov-registry.sql | 4 + .../sharing/registry/db/RepositoriesTest.java | 2 + .../sharing/registry/models/Sharing.java | 406 +- .../sharing/registry/models/SharingType.java | 45 + .../service/cpi/GovRegistryService.java | 6312 ++++++++++++++++-- .../thrift_models/sharing_cpi.thrift | 8 + .../thrift_models/sharing_models.thrift | 12 +- 9 files changed, 6127 insertions(+), 723 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java index a06e90d..500d622 100644 --- a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/entities/SharingEntity.java @@ -33,6 +33,9 @@ public class SharingEntity { private String permissionTypeId; private String entityId; private String groupId; + private String groupType; + private String sharingType; + private String inheritedPermissionTypeId; private Long createdTime; private Long updatedTime; private PermissionTypeEntity permissionTypeByPermissionTypeId; @@ -69,6 +72,36 @@ public class SharingEntity { } @Basic + @Column(name = "GROUP_TYPE") + public String getGroupType() { + return groupType; + } + + public void setGroupType(String groupType) { + this.groupType = groupType; + } + + @Basic + @Column(name = "SHARING_TYPE") + public String getSharingType() { + return sharingType; + } + + public void setSharingType(String sharingType) { + this.sharingType = sharingType; + } + + @Basic + @Column(name = "INHERITED_PARENT_PERMISSION_ID") + public String getInheritedPermissionTypeId() { + return inheritedPermissionTypeId; + } + + public void setInheritedPermissionTypeId(String inheritedPermissionTypeId) { + this.inheritedPermissionTypeId = inheritedPermissionTypeId; + } + + @Basic @Column(name = "CREATED_TIME") public Long getCreatedTime() { return createdTime; http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/GovRegistryServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/GovRegistryServerHandler.java b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/GovRegistryServerHandler.java index d657f3c..58b961a 100644 --- a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/GovRegistryServerHandler.java +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/GovRegistryServerHandler.java @@ -413,4 +413,32 @@ public class GovRegistryServerHandler implements GovRegistryService.Iface{ } return hashtable; } + + /** + * * Sharing Entity with Users and Groups + * * + * + * @param entityId + * @param userList + * @param permissionType + */ + @Override + public boolean shareEntityWithUsers(String entityId, List<String> userList, PermissionType perssionType) throws GovRegistryException, TException { + return false; + } + + @Override + public boolean revokeEntitySharingFromUsers(String entityId, List<String> userList, PermissionType perssionType) throws GovRegistryException, TException { + return false; + } + + @Override + public boolean shareEntityWithGroups(String entityId, List<String> groupList, PermissionType perssionType) throws GovRegistryException, TException { + return false; + } + + @Override + public boolean revokeEntitySharingFromGroups(String entityId, List<String> groupList, PermissionType perssionType) throws GovRegistryException, TException { + return false; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/resources/gov-registry.sql ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/resources/gov-registry.sql b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/resources/gov-registry.sql index f2bc98a..6f698f0 100644 --- a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/resources/gov-registry.sql +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/main/resources/gov-registry.sql @@ -116,10 +116,14 @@ CREATE TABLE SHARING ( PERMISSION_TYPE_ID VARCHAR(255) NOT NULL, ENTITY_ID VARCHAR(255) NOT NULL, GROUP_ID VARCHAR(255) NOT NULL, + GROUP_TYPE VARCHAR(255) NOT NULL, + SHARING_TYPE VARCHAR(255) NOT NULL, + INHERITED_PARENT_PERMISSION_ID VARCHAR(255), CREATED_TIME BIGINT NOT NULL, UPDATED_TIME BIGINT NOT NULL, PRIMARY KEY (PERMISSION_TYPE_ID, ENTITY_ID, GROUP_ID), FOREIGN KEY (PERMISSION_TYPE_ID) REFERENCES PERMISSION_TYPE(PERMISSION_TYPE_ID) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (INHERITED_PARENT_PERMISSION_ID) REFERENCES SHARING(PERMISSION_TYPE_ID) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (GROUP_ID) REFERENCES USER_GROUP(GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE ); http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/db/RepositoriesTest.java ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/db/RepositoriesTest.java b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/db/RepositoriesTest.java index aeeaafb..ed549fd 100644 --- a/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/db/RepositoriesTest.java +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/db/RepositoriesTest.java @@ -338,6 +338,7 @@ public class RepositoriesTest { sharing1.setPermissionTypeId(permissionType1Id); sharing1.setEntityId(entityId1); sharing1.setGroupId(userId2); + sharing1.setSharingType(SharingType.DIRECT); SharingRepository sharingRepository = new SharingRepository(); sharing1 = sharingRepository.create(sharing1); @@ -347,6 +348,7 @@ public class RepositoriesTest { sharing2.setPermissionTypeId(permissionType1Id); sharing2.setEntityId(entityId3); sharing2.setGroupId(groupId2); + sharing2.setSharingType(SharingType.DIRECT); sharingRepository.create(sharing2); } http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java b/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java index 41bdc96..43f049f 100644 --- a/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java @@ -6,32 +6,15 @@ */ package org.apache.airavata.sharing.registry.models; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; - import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; + import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.*; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-10-03") @@ -41,8 +24,11 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields private static final org.apache.thrift.protocol.TField PERMISSION_TYPE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("permissionTypeId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField ENTITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("entityId", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField GROUP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("groupId", org.apache.thrift.protocol.TType.STRING, (short)3); - 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)4); - 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)5); + private static final org.apache.thrift.protocol.TField GROUP_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("groupType", org.apache.thrift.protocol.TType.I32, (short)4); + private static final org.apache.thrift.protocol.TField SHARING_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("sharingType", org.apache.thrift.protocol.TType.I32, (short)5); + private static final org.apache.thrift.protocol.TField INHERITED_PERMISSION_TYPE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("inheritedPermissionTypeId", org.apache.thrift.protocol.TType.STRING, (short)6); + 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)7); + 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)8); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -53,6 +39,17 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields public String permissionTypeId; // optional public String entityId; // optional public String groupId; // optional + /** + * + * @see GroupType + */ + public GroupType groupType; // optional + /** + * + * @see SharingType + */ + public SharingType sharingType; // optional + public String inheritedPermissionTypeId; // optional public long createdTime; // optional public long updatedTime; // optional @@ -61,8 +58,19 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields PERMISSION_TYPE_ID((short)1, "permissionTypeId"), ENTITY_ID((short)2, "entityId"), GROUP_ID((short)3, "groupId"), - CREATED_TIME((short)4, "createdTime"), - UPDATED_TIME((short)5, "updatedTime"); + /** + * + * @see GroupType + */ + GROUP_TYPE((short)4, "groupType"), + /** + * + * @see SharingType + */ + SHARING_TYPE((short)5, "sharingType"), + INHERITED_PERMISSION_TYPE_ID((short)6, "inheritedPermissionTypeId"), + CREATED_TIME((short)7, "createdTime"), + UPDATED_TIME((short)8, "updatedTime"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -83,9 +91,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return ENTITY_ID; case 3: // GROUP_ID return GROUP_ID; - case 4: // CREATED_TIME + case 4: // GROUP_TYPE + return GROUP_TYPE; + case 5: // SHARING_TYPE + return SHARING_TYPE; + case 6: // INHERITED_PERMISSION_TYPE_ID + return INHERITED_PERMISSION_TYPE_ID; + case 7: // CREATED_TIME return CREATED_TIME; - case 5: // UPDATED_TIME + case 8: // UPDATED_TIME return UPDATED_TIME; default: return null; @@ -130,7 +144,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._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.PERMISSION_TYPE_ID,_Fields.ENTITY_ID,_Fields.GROUP_ID,_Fields.CREATED_TIME,_Fields.UPDATED_TIME}; + private static final _Fields optionals[] = {_Fields.PERMISSION_TYPE_ID,_Fields.ENTITY_ID,_Fields.GROUP_ID,_Fields.GROUP_TYPE,_Fields.SHARING_TYPE,_Fields.INHERITED_PERMISSION_TYPE_ID,_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); @@ -140,6 +154,12 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.GROUP_ID, new org.apache.thrift.meta_data.FieldMetaData("groupId", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.GROUP_TYPE, new org.apache.thrift.meta_data.FieldMetaData("groupType", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, GroupType.class))); + tmpMap.put(_Fields.SHARING_TYPE, new org.apache.thrift.meta_data.FieldMetaData("sharingType", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SharingType.class))); + tmpMap.put(_Fields.INHERITED_PERMISSION_TYPE_ID, new org.apache.thrift.meta_data.FieldMetaData("inheritedPermissionTypeId", 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, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.UPDATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("updatedTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, @@ -165,6 +185,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (other.isSetGroupId()) { this.groupId = other.groupId; } + if (other.isSetGroupType()) { + this.groupType = other.groupType; + } + if (other.isSetSharingType()) { + this.sharingType = other.sharingType; + } + if (other.isSetInheritedPermissionTypeId()) { + this.inheritedPermissionTypeId = other.inheritedPermissionTypeId; + } this.createdTime = other.createdTime; this.updatedTime = other.updatedTime; } @@ -178,6 +207,9 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields this.permissionTypeId = null; this.entityId = null; this.groupId = null; + this.groupType = null; + this.sharingType = null; + this.inheritedPermissionTypeId = null; setCreatedTimeIsSet(false); this.createdTime = 0; setUpdatedTimeIsSet(false); @@ -256,6 +288,94 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } } + /** + * + * @see GroupType + */ + public GroupType getGroupType() { + return this.groupType; + } + + /** + * + * @see GroupType + */ + public Sharing setGroupType(GroupType groupType) { + this.groupType = groupType; + return this; + } + + public void unsetGroupType() { + this.groupType = null; + } + + /** Returns true if field groupType is set (has been assigned a value) and false otherwise */ + public boolean isSetGroupType() { + return this.groupType != null; + } + + public void setGroupTypeIsSet(boolean value) { + if (!value) { + this.groupType = null; + } + } + + /** + * + * @see SharingType + */ + public SharingType getSharingType() { + return this.sharingType; + } + + /** + * + * @see SharingType + */ + public Sharing setSharingType(SharingType sharingType) { + this.sharingType = sharingType; + return this; + } + + public void unsetSharingType() { + this.sharingType = null; + } + + /** Returns true if field sharingType is set (has been assigned a value) and false otherwise */ + public boolean isSetSharingType() { + return this.sharingType != null; + } + + public void setSharingTypeIsSet(boolean value) { + if (!value) { + this.sharingType = null; + } + } + + public String getInheritedPermissionTypeId() { + return this.inheritedPermissionTypeId; + } + + public Sharing setInheritedPermissionTypeId(String inheritedPermissionTypeId) { + this.inheritedPermissionTypeId = inheritedPermissionTypeId; + return this; + } + + public void unsetInheritedPermissionTypeId() { + this.inheritedPermissionTypeId = null; + } + + /** Returns true if field inheritedPermissionTypeId is set (has been assigned a value) and false otherwise */ + public boolean isSetInheritedPermissionTypeId() { + return this.inheritedPermissionTypeId != null; + } + + public void setInheritedPermissionTypeIdIsSet(boolean value) { + if (!value) { + this.inheritedPermissionTypeId = null; + } + } + public long getCreatedTime() { return this.createdTime; } @@ -328,6 +448,30 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } break; + case GROUP_TYPE: + if (value == null) { + unsetGroupType(); + } else { + setGroupType((GroupType)value); + } + break; + + case SHARING_TYPE: + if (value == null) { + unsetSharingType(); + } else { + setSharingType((SharingType)value); + } + break; + + case INHERITED_PERMISSION_TYPE_ID: + if (value == null) { + unsetInheritedPermissionTypeId(); + } else { + setInheritedPermissionTypeId((String)value); + } + break; + case CREATED_TIME: if (value == null) { unsetCreatedTime(); @@ -358,6 +502,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields case GROUP_ID: return getGroupId(); + case GROUP_TYPE: + return getGroupType(); + + case SHARING_TYPE: + return getSharingType(); + + case INHERITED_PERMISSION_TYPE_ID: + return getInheritedPermissionTypeId(); + case CREATED_TIME: return getCreatedTime(); @@ -381,6 +534,12 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return isSetEntityId(); case GROUP_ID: return isSetGroupId(); + case GROUP_TYPE: + return isSetGroupType(); + case SHARING_TYPE: + return isSetSharingType(); + case INHERITED_PERMISSION_TYPE_ID: + return isSetInheritedPermissionTypeId(); case CREATED_TIME: return isSetCreatedTime(); case UPDATED_TIME: @@ -429,6 +588,33 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return false; } + boolean this_present_groupType = true && this.isSetGroupType(); + boolean that_present_groupType = true && that.isSetGroupType(); + if (this_present_groupType || that_present_groupType) { + if (!(this_present_groupType && that_present_groupType)) + return false; + if (!this.groupType.equals(that.groupType)) + return false; + } + + boolean this_present_sharingType = true && this.isSetSharingType(); + boolean that_present_sharingType = true && that.isSetSharingType(); + if (this_present_sharingType || that_present_sharingType) { + if (!(this_present_sharingType && that_present_sharingType)) + return false; + if (!this.sharingType.equals(that.sharingType)) + return false; + } + + boolean this_present_inheritedPermissionTypeId = true && this.isSetInheritedPermissionTypeId(); + boolean that_present_inheritedPermissionTypeId = true && that.isSetInheritedPermissionTypeId(); + if (this_present_inheritedPermissionTypeId || that_present_inheritedPermissionTypeId) { + if (!(this_present_inheritedPermissionTypeId && that_present_inheritedPermissionTypeId)) + return false; + if (!this.inheritedPermissionTypeId.equals(that.inheritedPermissionTypeId)) + return false; + } + boolean this_present_createdTime = true && this.isSetCreatedTime(); boolean that_present_createdTime = true && that.isSetCreatedTime(); if (this_present_createdTime || that_present_createdTime) { @@ -469,6 +655,21 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (present_groupId) list.add(groupId); + boolean present_groupType = true && (isSetGroupType()); + list.add(present_groupType); + if (present_groupType) + list.add(groupType.getValue()); + + boolean present_sharingType = true && (isSetSharingType()); + list.add(present_sharingType); + if (present_sharingType) + list.add(sharingType.getValue()); + + boolean present_inheritedPermissionTypeId = true && (isSetInheritedPermissionTypeId()); + list.add(present_inheritedPermissionTypeId); + if (present_inheritedPermissionTypeId) + list.add(inheritedPermissionTypeId); + boolean present_createdTime = true && (isSetCreatedTime()); list.add(present_createdTime); if (present_createdTime) @@ -520,6 +721,36 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return lastComparison; } } + lastComparison = Boolean.valueOf(isSetGroupType()).compareTo(other.isSetGroupType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetGroupType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupType, other.groupType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetSharingType()).compareTo(other.isSetSharingType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSharingType()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sharingType, other.sharingType); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetInheritedPermissionTypeId()).compareTo(other.isSetInheritedPermissionTypeId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInheritedPermissionTypeId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inheritedPermissionTypeId, other.inheritedPermissionTypeId); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetCreatedTime()).compareTo(other.isSetCreatedTime()); if (lastComparison != 0) { return lastComparison; @@ -589,6 +820,36 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } first = false; } + if (isSetGroupType()) { + if (!first) sb.append(", "); + sb.append("groupType:"); + if (this.groupType == null) { + sb.append("null"); + } else { + sb.append(this.groupType); + } + first = false; + } + if (isSetSharingType()) { + if (!first) sb.append(", "); + sb.append("sharingType:"); + if (this.sharingType == null) { + sb.append("null"); + } else { + sb.append(this.sharingType); + } + first = false; + } + if (isSetInheritedPermissionTypeId()) { + if (!first) sb.append(", "); + sb.append("inheritedPermissionTypeId:"); + if (this.inheritedPermissionTypeId == null) { + sb.append("null"); + } else { + sb.append(this.inheritedPermissionTypeId); + } + first = false; + } if (isSetCreatedTime()) { if (!first) sb.append(", "); sb.append("createdTime:"); @@ -670,7 +931,31 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 4: // CREATED_TIME + case 4: // GROUP_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.groupType = org.apache.airavata.sharing.registry.models.GroupType.findByValue(iprot.readI32()); + struct.setGroupTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // SHARING_TYPE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.sharingType = org.apache.airavata.sharing.registry.models.SharingType.findByValue(iprot.readI32()); + struct.setSharingTypeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // INHERITED_PERMISSION_TYPE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.inheritedPermissionTypeId = iprot.readString(); + struct.setInheritedPermissionTypeIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // CREATED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.createdTime = iprot.readI64(); struct.setCreatedTimeIsSet(true); @@ -678,7 +963,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // UPDATED_TIME + case 8: // UPDATED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.updatedTime = iprot.readI64(); struct.setUpdatedTimeIsSet(true); @@ -722,6 +1007,27 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields oprot.writeFieldEnd(); } } + if (struct.groupType != null) { + if (struct.isSetGroupType()) { + oprot.writeFieldBegin(GROUP_TYPE_FIELD_DESC); + oprot.writeI32(struct.groupType.getValue()); + oprot.writeFieldEnd(); + } + } + if (struct.sharingType != null) { + if (struct.isSetSharingType()) { + oprot.writeFieldBegin(SHARING_TYPE_FIELD_DESC); + oprot.writeI32(struct.sharingType.getValue()); + oprot.writeFieldEnd(); + } + } + if (struct.inheritedPermissionTypeId != null) { + if (struct.isSetInheritedPermissionTypeId()) { + oprot.writeFieldBegin(INHERITED_PERMISSION_TYPE_ID_FIELD_DESC); + oprot.writeString(struct.inheritedPermissionTypeId); + oprot.writeFieldEnd(); + } + } if (struct.isSetCreatedTime()) { oprot.writeFieldBegin(CREATED_TIME_FIELD_DESC); oprot.writeI64(struct.createdTime); @@ -759,13 +1065,22 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (struct.isSetGroupId()) { optionals.set(2); } - if (struct.isSetCreatedTime()) { + if (struct.isSetGroupType()) { optionals.set(3); } - if (struct.isSetUpdatedTime()) { + if (struct.isSetSharingType()) { optionals.set(4); } - oprot.writeBitSet(optionals, 5); + if (struct.isSetInheritedPermissionTypeId()) { + optionals.set(5); + } + if (struct.isSetCreatedTime()) { + optionals.set(6); + } + if (struct.isSetUpdatedTime()) { + optionals.set(7); + } + oprot.writeBitSet(optionals, 8); if (struct.isSetPermissionTypeId()) { oprot.writeString(struct.permissionTypeId); } @@ -775,6 +1090,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (struct.isSetGroupId()) { oprot.writeString(struct.groupId); } + if (struct.isSetGroupType()) { + oprot.writeI32(struct.groupType.getValue()); + } + if (struct.isSetSharingType()) { + oprot.writeI32(struct.sharingType.getValue()); + } + if (struct.isSetInheritedPermissionTypeId()) { + oprot.writeString(struct.inheritedPermissionTypeId); + } if (struct.isSetCreatedTime()) { oprot.writeI64(struct.createdTime); } @@ -786,7 +1110,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields @Override public void read(org.apache.thrift.protocol.TProtocol prot, Sharing struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(5); + BitSet incoming = iprot.readBitSet(8); if (incoming.get(0)) { struct.permissionTypeId = iprot.readString(); struct.setPermissionTypeIdIsSet(true); @@ -800,10 +1124,22 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields struct.setGroupIdIsSet(true); } if (incoming.get(3)) { + struct.groupType = org.apache.airavata.sharing.registry.models.GroupType.findByValue(iprot.readI32()); + struct.setGroupTypeIsSet(true); + } + if (incoming.get(4)) { + struct.sharingType = org.apache.airavata.sharing.registry.models.SharingType.findByValue(iprot.readI32()); + struct.setSharingTypeIsSet(true); + } + if (incoming.get(5)) { + struct.inheritedPermissionTypeId = iprot.readString(); + struct.setInheritedPermissionTypeIdIsSet(true); + } + if (incoming.get(6)) { struct.createdTime = iprot.readI64(); struct.setCreatedTimeIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(7)) { struct.updatedTime = iprot.readI64(); struct.setUpdatedTimeIsSet(true); } http://git-wip-us.apache.org/repos/asf/airavata/blob/a99f7661/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java ---------------------------------------------------------------------- diff --git a/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java b/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java new file mode 100644 index 0000000..ff9f919 --- /dev/null +++ b/modules/airavata-sharing-registry/airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java @@ -0,0 +1,45 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.sharing.registry.models; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum SharingType implements org.apache.thrift.TEnum { + DIRECT(0), + INHERITED(1); + + private final int value; + + private SharingType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static SharingType findByValue(int value) { + switch (value) { + case 0: + return DIRECT; + case 1: + return INHERITED; + default: + return null; + } + } +}
