All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gen.UserInfo Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package com.gen;

/**
 * Autogenerated by Thrift Compiler (0.13.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2021-02-04")
public class UserInfo implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo");

  private static final org.apache.thrift.protocol.TField MEDIA_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("MediaId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField MEDIA_CORE_USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("MediaCoreUserId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField MEDIA_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("MediaName", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("UserId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField ROLE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("RoleId", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField PERMISSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("Permissions", org.apache.thrift.protocol.TType.LIST, (short)6);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new UserInfoStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new UserInfoTupleSchemeFactory();

  public long MediaId; // required
  public long MediaCoreUserId; // required
  public @org.apache.thrift.annotation.Nullable String MediaName; // required
  public long UserId; // required
  public long RoleId; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List Permissions; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    MEDIA_ID((short)1, "MediaId"),
    MEDIA_CORE_USER_ID((short)2, "MediaCoreUserId"),
    MEDIA_NAME((short)3, "MediaName"),
    USER_ID((short)4, "UserId"),
    ROLE_ID((short)5, "RoleId"),
    PERMISSIONS((short)6, "Permissions");

    private static final java.util.Map byName = new java.util.HashMap();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // MEDIA_ID
          return MEDIA_ID;
        case 2: // MEDIA_CORE_USER_ID
          return MEDIA_CORE_USER_ID;
        case 3: // MEDIA_NAME
          return MEDIA_NAME;
        case 4: // USER_ID
          return USER_ID;
        case 5: // ROLE_ID
          return ROLE_ID;
        case 6: // PERMISSIONS
          return PERMISSIONS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __MEDIAID_ISSET_ID = 0;
  private static final int __MEDIACOREUSERID_ISSET_ID = 1;
  private static final int __USERID_ISSET_ID = 2;
  private static final int __ROLEID_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.ROLE_ID,_Fields.PERMISSIONS};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.MEDIA_ID, new org.apache.thrift.meta_data.FieldMetaData("MediaId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MEDIA_CORE_USER_ID, new org.apache.thrift.meta_data.FieldMetaData("MediaCoreUserId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MEDIA_NAME, new org.apache.thrift.meta_data.FieldMetaData("MediaName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("UserId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ROLE_ID, new org.apache.thrift.meta_data.FieldMetaData("RoleId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PERMISSIONS, new org.apache.thrift.meta_data.FieldMetaData("Permissions", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserInfo.class, metaDataMap);
  }

  public UserInfo() {
  }

  public UserInfo(
    long MediaId,
    long MediaCoreUserId,
    String MediaName,
    long UserId)
  {
    this();
    this.MediaId = MediaId;
    setMediaIdIsSet(true);
    this.MediaCoreUserId = MediaCoreUserId;
    setMediaCoreUserIdIsSet(true);
    this.MediaName = MediaName;
    this.UserId = UserId;
    setUserIdIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public UserInfo(UserInfo other) {
    __isset_bitfield = other.__isset_bitfield;
    this.MediaId = other.MediaId;
    this.MediaCoreUserId = other.MediaCoreUserId;
    if (other.isSetMediaName()) {
      this.MediaName = other.MediaName;
    }
    this.UserId = other.UserId;
    this.RoleId = other.RoleId;
    if (other.isSetPermissions()) {
      java.util.List __this__Permissions = new java.util.ArrayList(other.Permissions);
      this.Permissions = __this__Permissions;
    }
  }

  public UserInfo deepCopy() {
    return new UserInfo(this);
  }

  @Override
  public void clear() {
    setMediaIdIsSet(false);
    this.MediaId = 0;
    setMediaCoreUserIdIsSet(false);
    this.MediaCoreUserId = 0;
    this.MediaName = null;
    setUserIdIsSet(false);
    this.UserId = 0;
    setRoleIdIsSet(false);
    this.RoleId = 0;
    this.Permissions = null;
  }

  public long getMediaId() {
    return this.MediaId;
  }

  public UserInfo setMediaId(long MediaId) {
    this.MediaId = MediaId;
    setMediaIdIsSet(true);
    return this;
  }

  public void unsetMediaId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __MEDIAID_ISSET_ID);
  }

  /** Returns true if field MediaId is set (has been assigned a value) and false otherwise */
  public boolean isSetMediaId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __MEDIAID_ISSET_ID);
  }

  public void setMediaIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __MEDIAID_ISSET_ID, value);
  }

  public long getMediaCoreUserId() {
    return this.MediaCoreUserId;
  }

  public UserInfo setMediaCoreUserId(long MediaCoreUserId) {
    this.MediaCoreUserId = MediaCoreUserId;
    setMediaCoreUserIdIsSet(true);
    return this;
  }

  public void unsetMediaCoreUserId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __MEDIACOREUSERID_ISSET_ID);
  }

  /** Returns true if field MediaCoreUserId is set (has been assigned a value) and false otherwise */
  public boolean isSetMediaCoreUserId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __MEDIACOREUSERID_ISSET_ID);
  }

  public void setMediaCoreUserIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __MEDIACOREUSERID_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public String getMediaName() {
    return this.MediaName;
  }

  public UserInfo setMediaName(@org.apache.thrift.annotation.Nullable String MediaName) {
    this.MediaName = MediaName;
    return this;
  }

  public void unsetMediaName() {
    this.MediaName = null;
  }

  /** Returns true if field MediaName is set (has been assigned a value) and false otherwise */
  public boolean isSetMediaName() {
    return this.MediaName != null;
  }

  public void setMediaNameIsSet(boolean value) {
    if (!value) {
      this.MediaName = null;
    }
  }

  public long getUserId() {
    return this.UserId;
  }

  public UserInfo setUserId(long UserId) {
    this.UserId = UserId;
    setUserIdIsSet(true);
    return this;
  }

  public void unsetUserId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __USERID_ISSET_ID);
  }

  /** Returns true if field UserId is set (has been assigned a value) and false otherwise */
  public boolean isSetUserId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __USERID_ISSET_ID, value);
  }

  public long getRoleId() {
    return this.RoleId;
  }

  public UserInfo setRoleId(long RoleId) {
    this.RoleId = RoleId;
    setRoleIdIsSet(true);
    return this;
  }

  public void unsetRoleId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ROLEID_ISSET_ID);
  }

  /** Returns true if field RoleId is set (has been assigned a value) and false otherwise */
  public boolean isSetRoleId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ROLEID_ISSET_ID);
  }

  public void setRoleIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ROLEID_ISSET_ID, value);
  }

  public int getPermissionsSize() {
    return (this.Permissions == null) ? 0 : this.Permissions.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator getPermissionsIterator() {
    return (this.Permissions == null) ? null : this.Permissions.iterator();
  }

  public void addToPermissions(String elem) {
    if (this.Permissions == null) {
      this.Permissions = new java.util.ArrayList();
    }
    this.Permissions.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List getPermissions() {
    return this.Permissions;
  }

  public UserInfo setPermissions(@org.apache.thrift.annotation.Nullable java.util.List Permissions) {
    this.Permissions = Permissions;
    return this;
  }

  public void unsetPermissions() {
    this.Permissions = null;
  }

  /** Returns true if field Permissions is set (has been assigned a value) and false otherwise */
  public boolean isSetPermissions() {
    return this.Permissions != null;
  }

  public void setPermissionsIsSet(boolean value) {
    if (!value) {
      this.Permissions = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
    switch (field) {
    case MEDIA_ID:
      if (value == null) {
        unsetMediaId();
      } else {
        setMediaId((Long)value);
      }
      break;

    case MEDIA_CORE_USER_ID:
      if (value == null) {
        unsetMediaCoreUserId();
      } else {
        setMediaCoreUserId((Long)value);
      }
      break;

    case MEDIA_NAME:
      if (value == null) {
        unsetMediaName();
      } else {
        setMediaName((String)value);
      }
      break;

    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case ROLE_ID:
      if (value == null) {
        unsetRoleId();
      } else {
        setRoleId((Long)value);
      }
      break;

    case PERMISSIONS:
      if (value == null) {
        unsetPermissions();
      } else {
        setPermissions((java.util.List)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public Object getFieldValue(_Fields field) {
    switch (field) {
    case MEDIA_ID:
      return getMediaId();

    case MEDIA_CORE_USER_ID:
      return getMediaCoreUserId();

    case MEDIA_NAME:
      return getMediaName();

    case USER_ID:
      return getUserId();

    case ROLE_ID:
      return getRoleId();

    case PERMISSIONS:
      return getPermissions();

    }
    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 MEDIA_ID:
      return isSetMediaId();
    case MEDIA_CORE_USER_ID:
      return isSetMediaCoreUserId();
    case MEDIA_NAME:
      return isSetMediaName();
    case USER_ID:
      return isSetUserId();
    case ROLE_ID:
      return isSetRoleId();
    case PERMISSIONS:
      return isSetPermissions();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof UserInfo)
      return this.equals((UserInfo)that);
    return false;
  }

  public boolean equals(UserInfo that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_MediaId = true;
    boolean that_present_MediaId = true;
    if (this_present_MediaId || that_present_MediaId) {
      if (!(this_present_MediaId && that_present_MediaId))
        return false;
      if (this.MediaId != that.MediaId)
        return false;
    }

    boolean this_present_MediaCoreUserId = true;
    boolean that_present_MediaCoreUserId = true;
    if (this_present_MediaCoreUserId || that_present_MediaCoreUserId) {
      if (!(this_present_MediaCoreUserId && that_present_MediaCoreUserId))
        return false;
      if (this.MediaCoreUserId != that.MediaCoreUserId)
        return false;
    }

    boolean this_present_MediaName = true && this.isSetMediaName();
    boolean that_present_MediaName = true && that.isSetMediaName();
    if (this_present_MediaName || that_present_MediaName) {
      if (!(this_present_MediaName && that_present_MediaName))
        return false;
      if (!this.MediaName.equals(that.MediaName))
        return false;
    }

    boolean this_present_UserId = true;
    boolean that_present_UserId = true;
    if (this_present_UserId || that_present_UserId) {
      if (!(this_present_UserId && that_present_UserId))
        return false;
      if (this.UserId != that.UserId)
        return false;
    }

    boolean this_present_RoleId = true && this.isSetRoleId();
    boolean that_present_RoleId = true && that.isSetRoleId();
    if (this_present_RoleId || that_present_RoleId) {
      if (!(this_present_RoleId && that_present_RoleId))
        return false;
      if (this.RoleId != that.RoleId)
        return false;
    }

    boolean this_present_Permissions = true && this.isSetPermissions();
    boolean that_present_Permissions = true && that.isSetPermissions();
    if (this_present_Permissions || that_present_Permissions) {
      if (!(this_present_Permissions && that_present_Permissions))
        return false;
      if (!this.Permissions.equals(that.Permissions))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(MediaId);

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(MediaCoreUserId);

    hashCode = hashCode * 8191 + ((isSetMediaName()) ? 131071 : 524287);
    if (isSetMediaName())
      hashCode = hashCode * 8191 + MediaName.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(UserId);

    hashCode = hashCode * 8191 + ((isSetRoleId()) ? 131071 : 524287);
    if (isSetRoleId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(RoleId);

    hashCode = hashCode * 8191 + ((isSetPermissions()) ? 131071 : 524287);
    if (isSetPermissions())
      hashCode = hashCode * 8191 + Permissions.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(UserInfo other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetMediaId()).compareTo(other.isSetMediaId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMediaId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.MediaId, other.MediaId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMediaCoreUserId()).compareTo(other.isSetMediaCoreUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMediaCoreUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.MediaCoreUserId, other.MediaCoreUserId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMediaName()).compareTo(other.isSetMediaName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMediaName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.MediaName, other.MediaName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.UserId, other.UserId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRoleId()).compareTo(other.isSetRoleId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRoleId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.RoleId, other.RoleId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPermissions()).compareTo(other.isSetPermissions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPermissions()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.Permissions, other.Permissions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("UserInfo(");
    boolean first = true;

    sb.append("MediaId:");
    sb.append(this.MediaId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("MediaCoreUserId:");
    sb.append(this.MediaCoreUserId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("MediaName:");
    if (this.MediaName == null) {
      sb.append("null");
    } else {
      sb.append(this.MediaName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("UserId:");
    sb.append(this.UserId);
    first = false;
    if (isSetRoleId()) {
      if (!first) sb.append(", ");
      sb.append("RoleId:");
      sb.append(this.RoleId);
      first = false;
    }
    if (isSetPermissions()) {
      if (!first) sb.append(", ");
      sb.append("Permissions:");
      if (this.Permissions == null) {
        sb.append("null");
      } else {
        sb.append(this.Permissions);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'MediaId' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'MediaCoreUserId' because it's a primitive and you chose the non-beans generator.
    if (MediaName == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'MediaName' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'UserId' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      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);
    }
  }

  private static class UserInfoStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public UserInfoStandardScheme getScheme() {
      return new UserInfoStandardScheme();
    }
  }

  private static class UserInfoStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, UserInfo 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: // MEDIA_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.MediaId = iprot.readI64();
              struct.setMediaIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MEDIA_CORE_USER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.MediaCoreUserId = iprot.readI64();
              struct.setMediaCoreUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // MEDIA_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.MediaName = iprot.readString();
              struct.setMediaNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // USER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.UserId = iprot.readI64();
              struct.setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // ROLE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.RoleId = iprot.readI64();
              struct.setRoleIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // PERMISSIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
                struct.Permissions = new java.util.ArrayList(_list32.size);
                @org.apache.thrift.annotation.Nullable String _elem33;
                for (int _i34 = 0; _i34 < _list32.size; ++_i34)
                {
                  _elem33 = iprot.readString();
                  struct.Permissions.add(_elem33);
                }
                iprot.readListEnd();
              }
              struct.setPermissionsIsSet(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.isSetMediaId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'MediaId' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetMediaCoreUserId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'MediaCoreUserId' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetUserId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'UserId' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, UserInfo struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(MEDIA_ID_FIELD_DESC);
      oprot.writeI64(struct.MediaId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MEDIA_CORE_USER_ID_FIELD_DESC);
      oprot.writeI64(struct.MediaCoreUserId);
      oprot.writeFieldEnd();
      if (struct.MediaName != null) {
        oprot.writeFieldBegin(MEDIA_NAME_FIELD_DESC);
        oprot.writeString(struct.MediaName);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(USER_ID_FIELD_DESC);
      oprot.writeI64(struct.UserId);
      oprot.writeFieldEnd();
      if (struct.isSetRoleId()) {
        oprot.writeFieldBegin(ROLE_ID_FIELD_DESC);
        oprot.writeI64(struct.RoleId);
        oprot.writeFieldEnd();
      }
      if (struct.Permissions != null) {
        if (struct.isSetPermissions()) {
          oprot.writeFieldBegin(PERMISSIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.Permissions.size()));
            for (String _iter35 : struct.Permissions)
            {
              oprot.writeString(_iter35);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class UserInfoTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public UserInfoTupleScheme getScheme() {
      return new UserInfoTupleScheme();
    }
  }

  private static class UserInfoTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.MediaId);
      oprot.writeI64(struct.MediaCoreUserId);
      oprot.writeString(struct.MediaName);
      oprot.writeI64(struct.UserId);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetRoleId()) {
        optionals.set(0);
      }
      if (struct.isSetPermissions()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetRoleId()) {
        oprot.writeI64(struct.RoleId);
      }
      if (struct.isSetPermissions()) {
        {
          oprot.writeI32(struct.Permissions.size());
          for (String _iter36 : struct.Permissions)
          {
            oprot.writeString(_iter36);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.MediaId = iprot.readI64();
      struct.setMediaIdIsSet(true);
      struct.MediaCoreUserId = iprot.readI64();
      struct.setMediaCoreUserIdIsSet(true);
      struct.MediaName = iprot.readString();
      struct.setMediaNameIsSet(true);
      struct.UserId = iprot.readI64();
      struct.setUserIdIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.RoleId = iprot.readI64();
        struct.setRoleIdIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.Permissions = new java.util.ArrayList(_list37.size);
          @org.apache.thrift.annotation.Nullable String _elem38;
          for (int _i39 = 0; _i39 < _list37.size; ++_i39)
          {
            _elem38 = iprot.readString();
            struct.Permissions.add(_elem38);
          }
        }
        struct.setPermissionsIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy