public TPermissionsUpdate deepCopy() { return new TPermissionsUpdate(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TPermissionsUpdate) return this.equals((TPermissionsUpdate)that); return false; }
public Object getFieldValue(_Fields field) { switch (field) { case HASFULL_IMAGE: return Boolean.valueOf(isHasfullImage()); case SEQ_NUM: return Long.valueOf(getSeqNum()); case PRIVILEGE_CHANGES: return getPrivilegeChanges(); case ROLE_CHANGES: return getRoleChanges(); } throw new IllegalStateException(); }
/** 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 HASFULL_IMAGE: return isSetHasfullImage(); case SEQ_NUM: return isSetSeqNum(); case PRIVILEGE_CHANGES: return isSetPrivilegeChanges(); case ROLE_CHANGES: return isSetRoleChanges(); } throw new IllegalStateException(); }
@Override public PermissionsUpdate retrieveFullImage(long currSeqNum) { final Timer.Context timerContext = SentryHdfsMetricsUtil.getRetrieveFullImageTimer.time(); Map<String, HashMap<String, String>> privilegeImage = sentryStore.retrieveFullPrivilegeImage(); Map<String, LinkedList<String>> roleImage = sentryStore.retrieveFullRoleImage(); TPermissionsUpdate tPermUpdate = new TPermissionsUpdate(true, currSeqNum, new HashMap<String, TPrivilegeChanges>(), new HashMap<String, TRoleChanges>()); for (Map.Entry<String, HashMap<String, String>> privEnt : privilegeImage.entrySet()) { String authzObj = privEnt.getKey(); HashMap<String,String> privs = privEnt.getValue(); tPermUpdate.putToPrivilegeChanges(authzObj, new TPrivilegeChanges( authzObj, privs, new HashMap<String, String>())); } for (Map.Entry<String, LinkedList<String>> privEnt : roleImage.entrySet()) { String role = privEnt.getKey(); LinkedList<String> groups = privEnt.getValue(); tPermUpdate.putToRoleChanges(role, new TRoleChanges(role, groups, new LinkedList<String>())); } PermissionsUpdate permissionsUpdate = new PermissionsUpdate(tPermUpdate); permissionsUpdate.setSeqNum(currSeqNum); timerContext.stop(); SentryHdfsMetricsUtil.getPrivilegeChangesHistogram.update( tPermUpdate.getPrivilegeChangesSize()); SentryHdfsMetricsUtil.getRoleChangesHistogram.update( tPermUpdate.getRoleChangesSize()); return permissionsUpdate; }
_elem137 = new TPermissionsUpdate(); _elem137.read(iprot); struct.authzPermUpdate.add(_elem137);
boolean this_present_privilegeChanges = true && this.isSetPrivilegeChanges(); boolean that_present_privilegeChanges = true && that.isSetPrivilegeChanges(); if (this_present_privilegeChanges || that_present_privilegeChanges) { if (!(this_present_privilegeChanges && that_present_privilegeChanges)) boolean this_present_roleChanges = true && this.isSetRoleChanges(); boolean that_present_roleChanges = true && that.isSetRoleChanges(); if (this_present_roleChanges || that_present_roleChanges) { if (!(this_present_roleChanges && that_present_roleChanges))
public Collection<TPrivilegeChanges> getPrivilegeUpdates() { return tPermUpdate.getPrivilegeChanges().values(); }
public Collection<TRoleChanges> getRoleUpdates() { return tPermUpdate.getRoleChanges().values(); }
@Override public long getSeqNum() { return tPermUpdate.getSeqNum(); }
@Override public boolean hasFullImage() { return tPermUpdate.isHasfullImage(); }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetHasfullImage()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'hasfullImage' is unset! Struct:" + toString()); } if (!isSetSeqNum()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'seqNum' is unset! Struct:" + toString()); } if (!isSetPrivilegeChanges()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeChanges' is unset! Struct:" + toString()); } if (!isSetRoleChanges()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleChanges' is unset! Struct:" + toString()); } // check for sub-struct validity }
_elem127 = new TPermissionsUpdate(); _elem127.read(iprot); struct.authzPermUpdate.add(_elem127);
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_hasfullImage = true; builder.append(present_hasfullImage); if (present_hasfullImage) builder.append(hasfullImage); boolean present_seqNum = true; builder.append(present_seqNum); if (present_seqNum) builder.append(seqNum); boolean present_privilegeChanges = true && (isSetPrivilegeChanges()); builder.append(present_privilegeChanges); if (present_privilegeChanges) builder.append(privilegeChanges); boolean present_roleChanges = true && (isSetRoleChanges()); builder.append(present_roleChanges); if (present_roleChanges) builder.append(roleChanges); return builder.toHashCode(); }
public TPrivilegeChanges addPrivilegeUpdate(String authzObj) { if (tPermUpdate.getPrivilegeChanges().containsKey(authzObj)) { return tPermUpdate.getPrivilegeChanges().get(authzObj); } TPrivilegeChanges privUpdate = new TPrivilegeChanges(authzObj, new HashMap<String, String>(), new HashMap<String, String>()); tPermUpdate.getPrivilegeChanges().put(authzObj, privUpdate); return privUpdate; }
public TRoleChanges addRoleUpdate(String role) { if (tPermUpdate.getRoleChanges().containsKey(role)) { return tPermUpdate.getRoleChanges().get(role); } TRoleChanges roleUpdate = new TRoleChanges(role, new LinkedList<String>(), new LinkedList<String>()); tPermUpdate.getRoleChanges().put(role, roleUpdate); return roleUpdate; }
lastComparison = Boolean.valueOf(isSetHasfullImage()).compareTo(typedOther.isSetHasfullImage()); if (lastComparison != 0) { return lastComparison; if (isSetHasfullImage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasfullImage, typedOther.hasfullImage); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetSeqNum()).compareTo(typedOther.isSetSeqNum()); if (lastComparison != 0) { return lastComparison; if (isSetSeqNum()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.seqNum, typedOther.seqNum); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetPrivilegeChanges()).compareTo(typedOther.isSetPrivilegeChanges()); if (lastComparison != 0) { return lastComparison; if (isSetPrivilegeChanges()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeChanges, typedOther.privilegeChanges); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetRoleChanges()).compareTo(typedOther.isSetRoleChanges()); if (lastComparison != 0) { return lastComparison; if (isSetRoleChanges()) {
public PermissionsUpdate(long seqNum, boolean hasFullImage) { this.tPermUpdate = new TPermissionsUpdate(hasFullImage, seqNum, new HashMap<String, TPrivilegeChanges>(), new HashMap<String, TRoleChanges>()); }
/** * Performs a deep copy on <i>other</i>. */ public TPermissionsUpdate(TPermissionsUpdate other) { __isset_bitfield = other.__isset_bitfield; this.hasfullImage = other.hasfullImage; this.seqNum = other.seqNum; if (other.isSetPrivilegeChanges()) { Map<String,TPrivilegeChanges> __this__privilegeChanges = new HashMap<String,TPrivilegeChanges>(); for (Map.Entry<String, TPrivilegeChanges> other_element : other.privilegeChanges.entrySet()) { String other_element_key = other_element.getKey(); TPrivilegeChanges other_element_value = other_element.getValue(); String __this__privilegeChanges_copy_key = other_element_key; TPrivilegeChanges __this__privilegeChanges_copy_value = new TPrivilegeChanges(other_element_value); __this__privilegeChanges.put(__this__privilegeChanges_copy_key, __this__privilegeChanges_copy_value); } this.privilegeChanges = __this__privilegeChanges; } if (other.isSetRoleChanges()) { Map<String,TRoleChanges> __this__roleChanges = new HashMap<String,TRoleChanges>(); for (Map.Entry<String, TRoleChanges> other_element : other.roleChanges.entrySet()) { String other_element_key = other_element.getKey(); TRoleChanges other_element_value = other_element.getValue(); String __this__roleChanges_copy_key = other_element_key; TRoleChanges __this__roleChanges_copy_value = new TRoleChanges(other_element_value); __this__roleChanges.put(__this__roleChanges_copy_key, __this__roleChanges_copy_value); } this.roleChanges = __this__roleChanges; } }
/** * Performs a deep copy on <i>other</i>. */ public TAuthzUpdateResponse(TAuthzUpdateResponse other) { if (other.isSetAuthzPathUpdate()) { List<TPathsUpdate> __this__authzPathUpdate = new ArrayList<TPathsUpdate>(); for (TPathsUpdate other_element : other.authzPathUpdate) { __this__authzPathUpdate.add(new TPathsUpdate(other_element)); } this.authzPathUpdate = __this__authzPathUpdate; } if (other.isSetAuthzPermUpdate()) { List<TPermissionsUpdate> __this__authzPermUpdate = new ArrayList<TPermissionsUpdate>(); for (TPermissionsUpdate other_element : other.authzPermUpdate) { __this__authzPermUpdate.add(new TPermissionsUpdate(other_element)); } this.authzPermUpdate = __this__authzPermUpdate; } }