public boolean equals(TPermissionsUpdate that) {
    if (that == null) return false;

    boolean this_present_hasfullImage = true;
    boolean that_present_hasfullImage = true;
    if (this_present_hasfullImage || that_present_hasfullImage) {
      if (!(this_present_hasfullImage && that_present_hasfullImage)) return false;
      if (this.hasfullImage != that.hasfullImage) return false;
    }

    boolean this_present_seqNum = true;
    boolean that_present_seqNum = true;
    if (this_present_seqNum || that_present_seqNum) {
      if (!(this_present_seqNum && that_present_seqNum)) return false;
      if (this.seqNum != that.seqNum) return false;
    }

    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)) return false;
      if (!this.privilegeChanges.equals(that.privilegeChanges)) return false;
    }

    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)) return false;
      if (!this.roleChanges.equals(that.roleChanges)) return false;
    }

    return true;
  }
  public int compareTo(TPermissionsUpdate other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TPermissionsUpdate typedOther = (TPermissionsUpdate) other;

    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) {
        return lastComparison;
      }
    }
    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) {
        return lastComparison;
      }
    }
    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) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoleChanges()).compareTo(typedOther.isSetRoleChanges());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoleChanges()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.roleChanges, typedOther.roleChanges);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
  /** 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;
    }
  }
    public void write(org.apache.thrift.protocol.TProtocol oprot, TPermissionsUpdate struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(HASFULL_IMAGE_FIELD_DESC);
      oprot.writeBool(struct.hasfullImage);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(SEQ_NUM_FIELD_DESC);
      oprot.writeI64(struct.seqNum);
      oprot.writeFieldEnd();
      if (struct.privilegeChanges != null) {
        oprot.writeFieldBegin(PRIVILEGE_CHANGES_FIELD_DESC);
        {
          oprot.writeMapBegin(
              new org.apache.thrift.protocol.TMap(
                  org.apache.thrift.protocol.TType.STRING,
                  org.apache.thrift.protocol.TType.STRUCT,
                  struct.privilegeChanges.size()));
          for (Map.Entry<String, TPrivilegeChanges> _iter110 : struct.privilegeChanges.entrySet()) {
            oprot.writeString(_iter110.getKey());
            _iter110.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.roleChanges != null) {
        oprot.writeFieldBegin(ROLE_CHANGES_FIELD_DESC);
        {
          oprot.writeMapBegin(
              new org.apache.thrift.protocol.TMap(
                  org.apache.thrift.protocol.TType.STRING,
                  org.apache.thrift.protocol.TType.STRUCT,
                  struct.roleChanges.size()));
          for (Map.Entry<String, TRoleChanges> _iter111 : struct.roleChanges.entrySet()) {
            oprot.writeString(_iter111.getKey());
            _iter111.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TPermissionsUpdate struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.hasfullImage = iprot.readBool();
   struct.setHasfullImageIsSet(true);
   struct.seqNum = iprot.readI64();
   struct.setSeqNumIsSet(true);
   {
     org.apache.thrift.protocol.TMap _map114 =
         new org.apache.thrift.protocol.TMap(
             org.apache.thrift.protocol.TType.STRING,
             org.apache.thrift.protocol.TType.STRUCT,
             iprot.readI32());
     struct.privilegeChanges = new HashMap<String, TPrivilegeChanges>(2 * _map114.size);
     for (int _i115 = 0; _i115 < _map114.size; ++_i115) {
       String _key116; // required
       TPrivilegeChanges _val117; // required
       _key116 = iprot.readString();
       _val117 = new TPrivilegeChanges();
       _val117.read(iprot);
       struct.privilegeChanges.put(_key116, _val117);
     }
   }
   struct.setPrivilegeChangesIsSet(true);
   {
     org.apache.thrift.protocol.TMap _map118 =
         new org.apache.thrift.protocol.TMap(
             org.apache.thrift.protocol.TType.STRING,
             org.apache.thrift.protocol.TType.STRUCT,
             iprot.readI32());
     struct.roleChanges = new HashMap<String, TRoleChanges>(2 * _map118.size);
     for (int _i119 = 0; _i119 < _map118.size; ++_i119) {
       String _key120; // required
       TRoleChanges _val121; // required
       _key120 = iprot.readString();
       _val121 = new TRoleChanges();
       _val121.read(iprot);
       struct.roleChanges.put(_key120, _val121);
     }
   }
   struct.setRoleChangesIsSet(true);
 }
    public void read(org.apache.thrift.protocol.TProtocol iprot, TPermissionsUpdate 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: // HASFULL_IMAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.hasfullImage = iprot.readBool();
              struct.setHasfullImageIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SEQ_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.seqNum = iprot.readI64();
              struct.setSeqNumIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PRIVILEGE_CHANGES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map102 = iprot.readMapBegin();
                struct.privilegeChanges = new HashMap<String, TPrivilegeChanges>(2 * _map102.size);
                for (int _i103 = 0; _i103 < _map102.size; ++_i103) {
                  String _key104; // required
                  TPrivilegeChanges _val105; // required
                  _key104 = iprot.readString();
                  _val105 = new TPrivilegeChanges();
                  _val105.read(iprot);
                  struct.privilegeChanges.put(_key104, _val105);
                }
                iprot.readMapEnd();
              }
              struct.setPrivilegeChangesIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ROLE_CHANGES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map106 = iprot.readMapBegin();
                struct.roleChanges = new HashMap<String, TRoleChanges>(2 * _map106.size);
                for (int _i107 = 0; _i107 < _map106.size; ++_i107) {
                  String _key108; // required
                  TRoleChanges _val109; // required
                  _key108 = iprot.readString();
                  _val109 = new TRoleChanges();
                  _val109.read(iprot);
                  struct.roleChanges.put(_key108, _val109);
                }
                iprot.readMapEnd();
              }
              struct.setRoleChangesIsSet(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();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetHasfullImage()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'hasfullImage' was not found in serialized data! Struct: "
                + toString());
      }
      if (!struct.isSetSeqNum()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'seqNum' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }