public boolean equals(Role that) { if (that == null) return false; boolean this_present_roleName = true && this.isSetRoleName(); boolean that_present_roleName = true && that.isSetRoleName(); if (this_present_roleName || that_present_roleName) { if (!(this_present_roleName && that_present_roleName)) return false; if (!this.roleName.equals(that.roleName)) return false; } boolean this_present_createTime = true; boolean that_present_createTime = true; if (this_present_createTime || that_present_createTime) { if (!(this_present_createTime && that_present_createTime)) return false; if (this.createTime != that.createTime) return false; } boolean this_present_ownerName = true && this.isSetOwnerName(); boolean that_present_ownerName = true && that.isSetOwnerName(); if (this_present_ownerName || that_present_ownerName) { if (!(this_present_ownerName && that_present_ownerName)) return false; if (!this.ownerName.equals(that.ownerName)) return false; } return true; }
/** Performs a deep copy on <i>other</i>. */ public Role(Role other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetRoleName()) { this.roleName = other.roleName; } this.createTime = other.createTime; if (other.isSetOwnerName()) { this.ownerName = other.ownerName; } }
/** Test role operation */ @Test public void testRoleOps() throws InvalidObjectException, MetaException, NoSuchObjectException { objectStore.addRole(ROLE1, OWNER); objectStore.addRole(ROLE2, OWNER); List<String> roles = objectStore.listRoleNames(); Assert.assertEquals(2, roles.size()); Assert.assertEquals(ROLE2, roles.get(1)); Role role1 = objectStore.getRole(ROLE1); Assert.assertEquals(OWNER, role1.getOwnerName()); objectStore.grantRole(role1, USER1, PrincipalType.USER, OWNER, PrincipalType.ROLE, true); objectStore.revokeRole(role1, USER1, PrincipalType.USER, false); objectStore.removeRole(ROLE1); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, Role struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetRoleName()) { optionals.set(0); } if (struct.isSetCreateTime()) { optionals.set(1); } if (struct.isSetOwnerName()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetRoleName()) { oprot.writeString(struct.roleName); } if (struct.isSetCreateTime()) { oprot.writeI32(struct.createTime); } if (struct.isSetOwnerName()) { oprot.writeString(struct.ownerName); } }
@Override public int compareTo(Role other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName()); if (lastComparison != 0) { return lastComparison; } if (isSetRoleName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime()); if (lastComparison != 0) { return lastComparison; } if (isSetCreateTime()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetOwnerName()).compareTo(other.isSetOwnerName()); if (lastComparison != 0) { return lastComparison; } if (isSetOwnerName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerName, other.ownerName); if (lastComparison != 0) { return lastComparison; } } return 0; }
public void write(org.apache.thrift.protocol.TProtocol oprot, Role struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.roleName != null) { oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC); oprot.writeString(struct.roleName); oprot.writeFieldEnd(); } oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC); oprot.writeI32(struct.createTime); oprot.writeFieldEnd(); if (struct.ownerName != null) { oprot.writeFieldBegin(OWNER_NAME_FIELD_DESC); oprot.writeString(struct.ownerName); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, Role 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: // ROLE_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.roleName = iprot.readString(); struct.setRoleNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // CREATE_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // OWNER_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.ownerName = iprot.readString(); struct.setOwnerNameIsSet(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(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Role struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.roleName = iprot.readString(); struct.setRoleNameIsSet(true); } if (incoming.get(1)) { struct.createTime = iprot.readI32(); struct.setCreateTimeIsSet(true); } if (incoming.get(2)) { struct.ownerName = iprot.readString(); struct.setOwnerNameIsSet(true); } }