@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_status = true && (isSetStatus()); builder.append(present_status); if (present_status) builder.append(status); boolean present_privilege = true && (isSetPrivilege()); builder.append(present_privilege); if (present_privilege) builder.append(privilege); boolean present_privileges = true && (isSetPrivileges()); builder.append(present_privileges); if (present_privileges) builder.append(privileges); return builder.toHashCode(); }
/** 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 STATUS: return isSetStatus(); case PRIVILEGE: return isSetPrivilege(); case PRIVILEGES: return isSetPrivileges(); } throw new IllegalStateException(); }
if (isSetPrivileges()) { if (!first) sb.append(", "); sb.append("privileges:");
lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges()); if (lastComparison != 0) { return lastComparison; if (isSetPrivileges()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges); if (lastComparison != 0) {
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.status.write(oprot); BitSet optionals = new BitSet(); if (struct.isSetPrivilege()) { optionals.set(0); } if (struct.isSetPrivileges()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetPrivilege()) { struct.privilege.write(oprot); } if (struct.isSetPrivileges()) { { oprot.writeI32(struct.privileges.size()); for (TSentryPrivilege _iter28 : struct.privileges) { _iter28.write(oprot); } } } }
if (struct.isSetPrivileges()) { oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
/** * Performs a deep copy on <i>other</i>. */ public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) { if (other.isSetStatus()) { this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status); } if (other.isSetPrivilege()) { this.privilege = new TSentryPrivilege(other.privilege); } if (other.isSetPrivileges()) { Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(); for (TSentryPrivilege other_element : other.privileges) { __this__privileges.add(new TSentryPrivilege(other_element)); } this.privileges = __this__privileges; } }
public boolean equals(TAlterSentryRoleGrantPrivilegeResponse that) { if (that == null) return false; boolean this_present_status = true && this.isSetStatus(); boolean that_present_status = true && that.isSetStatus(); if (this_present_status || that_present_status) { if (!(this_present_status && that_present_status)) return false; if (!this.status.equals(that.status)) return false; } boolean this_present_privilege = true && this.isSetPrivilege(); boolean that_present_privilege = true && that.isSetPrivilege(); if (this_present_privilege || that_present_privilege) { if (!(this_present_privilege && that_present_privilege)) return false; if (!this.privilege.equals(that.privilege)) return false; } boolean this_present_privileges = true && this.isSetPrivileges(); boolean that_present_privileges = true && that.isSetPrivileges(); if (this_present_privileges || that_present_privileges) { if (!(this_present_privileges && that_present_privileges)) return false; if (!this.privileges.equals(that.privileges)) return false; } return true; }
private TSentryPrivilege grantPrivilege(String requestorUserName, String roleName, PrivilegeScope scope, String serverName, String uri, String db, String table, String column, String action, Boolean grantOption) throws SentryUserException { TAlterSentryRoleGrantPrivilegeRequest request = new TAlterSentryRoleGrantPrivilegeRequest(); request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); request.setRequestorUserName(requestorUserName); request.setRoleName(roleName); Set<TSentryPrivilege> privileges = convertColumnPrivilege(scope, serverName, uri, db, table, column, action, grantOption); request.setPrivileges(privileges); try { TAlterSentryRoleGrantPrivilegeResponse response = client.alter_sentry_role_grant_privilege(request); Status.throwIfNotOk(response.getStatus()); if (response.isSetPrivileges() && response.getPrivilegesSize()>0 ) { return response.getPrivileges().iterator().next(); } else { return new TSentryPrivilege(); } } catch (TException e) { throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e); } }
response.setPrivileges(request.getPrivileges()); if (response.isSetPrivileges() && response.getPrivileges().size() == 1) { response.setPrivilege(response.getPrivileges().iterator().next());