private Set<TSentryGroup> getGroups() { Set<TSentryGroup> groups = new LinkedHashSet<TSentryGroup>(); TSentryGroup group = new TSentryGroup(); group.setGroupName(TEST_GROUP); groups.add(group); return groups; } }
public Object getFieldValue(_Fields field) { switch (field) { case GROUP_NAME: return getGroupName(); } throw new IllegalStateException(); }
@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 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(); }
public TSentryGroup deepCopy() { return new TSentryGroup(this); }
for (int _i58 = 0; _i58 < _set56.size; ++_i58) _elem57 = new TSentryGroup(); _elem57.read(iprot); struct.groups.add(_elem57);
TSentryGroup group = new TSentryGroup(); group.setGroupName("test-groups-g1"); groups.add(group); group = new TSentryGroup(); group.setGroupName("test-groups-g2"); groups.add(group); TRoleChanges addrUpdate = addUpdate.addRoleUpdate(roleName); for (TSentryGroup g : groups) { addrUpdate.addToAddGroups(g.getGroupName()); TRoleChanges delrUpdate = delUpdate.addRoleUpdate(roleName); for (TSentryGroup g : groups) { delrUpdate.addToDelGroups(g.getGroupName());
/** * 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> 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 _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.groups = new HashSet<TSentryGroup>(2*_set61.size); TSentryGroup _elem62; for (int _i63 = 0; _i63 < _set61.size; ++_i63) { _elem62 = new TSentryGroup(); _elem62.read(iprot); struct.groups.add(_elem62); } } struct.setGroupsIsSet(true); struct.grantorPrincipal = iprot.readString(); struct.setGrantorPrincipalIsSet(true); } }
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; }
@Test public void testAddDeleteGroups() throws Exception { String roleName = "test-groups"; String grantor = "g1"; createRole(roleName); Set<TSentryGroup> groups = Sets.newHashSet(); TSentryGroup group = new TSentryGroup(); group.setGroupName("test-groups-g1"); groups.add(group); group = new TSentryGroup(); group.setGroupName("test-groups-g2"); groups.add(group); sentryStore.alterSentryRoleAddGroups(grantor, roleName, groups); sentryStore.alterSentryRoleDeleteGroups(roleName, groups); MSentryRole role = sentryStore.getMSentryRoleByName(roleName); assertEquals(Collections.emptySet(), role.getGroups()); }
private Set<TSentryGroup> toTSentryGroups(Set<String> groups) { if (groups.isEmpty()) { return Collections.emptySet(); } Set<TSentryGroup> tSentryGroups = new HashSet<>(groups.size()); for (String group : groups) { tSentryGroups.add(new TSentryGroup(group)); } return tSentryGroups; }
for (int _i18 = 0; _i18 < _set16.size; ++_i18) _elem17 = new TSentryGroup(); _elem17.read(iprot); struct.groups.add(_elem17);
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(); }
/** 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(); }