public Object getFieldValue(_Fields field) { switch (field) { case GROUP_NAME: return getGroupName(); } throw new IllegalStateException(); }
private TSentryGroup convertToTSentryGroup(MSentryGroup mSentryGroup) { TSentryGroup group = new TSentryGroup(); group.setGroupName(mSentryGroup.getGroupName()); return group; }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSentryGroup) return this.equals((TSentryGroup)that); return false; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case GROUP_NAME: if (value == null) { unsetGroupName(); } else { setGroupName((String)value); } break; } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetGroupName()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'groupName' is unset! Struct:" + toString()); } // check for sub-struct validity }
public TSentryGroup deepCopy() { return new TSentryGroup(this); }
_elem42 = new TSentryGroup(); _elem42.read(iprot); struct.groups.add(_elem42);
public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryGroup struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // GROUP_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.groupName = iprot.readString(); struct.setGroupNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }
/** * Performs a deep copy on <i>other</i>. */ public TSentryGroup(TSentryGroup other) { if (other.isSetGroupName()) { this.groupName = other.groupName; } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.groupName = iprot.readString(); struct.setGroupNameIsSet(true); } }
private Set<TSentryGroup> toTSentryGroups(Set<String> groups) { Set<TSentryGroup> tSentryGroups = Sets.newHashSet(); for (String group : groups) { tSentryGroups.add(new TSentryGroup(group)); } return tSentryGroups; }
_elem2 = new TSentryGroup(); _elem2.read(iprot); struct.groups.add(_elem2);
public boolean equals(TSentryGroup that) { if (that == null) return false; boolean this_present_groupName = true && this.isSetGroupName(); boolean that_present_groupName = true && that.isSetGroupName(); if (this_present_groupName || that_present_groupName) { if (!(this_present_groupName && that_present_groupName)) return false; if (!this.groupName.equals(that.groupName)) return false; } return true; }
private Set<TSentryGroup> getGroups() { Set<TSentryGroup> groups = new LinkedHashSet<TSentryGroup>(); TSentryGroup group = new TSentryGroup(); group.setGroupName(TEST_GROUP); groups.add(group); return groups; } }
private String getGroupsStr(Iterator<TSentryGroup> iter) { StringBuilder groups = new StringBuilder(""); if (iter != null) { boolean commaFlg = false; while (iter.hasNext()) { if (commaFlg) { groups.append(", "); } else { commaFlg = true; } groups.append(iter.next().getGroupName()); } } return groups.toString(); }
private Set<TSentryGroup> convert2TGroups(Set<String> groups) { Set<TSentryGroup> tGroups = Sets.newHashSet(); if (groups != null) { for (String groupName : groups) { tGroups.add(new TSentryGroup(groupName)); } } return tGroups; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.roleName = iprot.readString(); struct.setRoleNameIsSet(true); { org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.groups = new HashSet<TSentryGroup>(2*_set45.size); for (int _i46 = 0; _i46 < _set45.size; ++_i46) { TSentryGroup _elem47; // required _elem47 = new TSentryGroup(); _elem47.read(iprot); struct.groups.add(_elem47); } } struct.setGroupsIsSet(true); struct.grantorPrincipal = iprot.readString(); struct.setGrantorPrincipalIsSet(true); } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case GROUP_NAME: return isSetGroupName(); } throw new IllegalStateException(); }
@Test public void testSentryGroupsSize() throws Exception { String role1 = "role1"; String role2 = "role2"; sentryStore.createSentryRole(role1); sentryStore.createSentryRole(role2); Set<TSentryGroup> groups = Sets.newHashSet(); TSentryGroup group = new TSentryGroup(); group.setGroupName("group1"); groups.add(group); String grantor = "g1"; sentryStore.alterSentryRoleAddGroups(grantor, role1, groups); assertEquals(Long.valueOf(1), sentryStore.getGroupCountGauge().getValue()); sentryStore.alterSentryRoleAddGroups(grantor, role2, groups); assertEquals(Long.valueOf(1), sentryStore.getGroupCountGauge().getValue()); groups.add(new TSentryGroup("group2")); sentryStore.alterSentryRoleAddGroups(grantor, role2, groups); assertEquals(Long.valueOf(2), sentryStore.getGroupCountGauge().getValue()); }