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

tech.aroma.thrift.authentication.UserToken Maven / Gradle / Ivy

Go to download

Part of the Aroma Project. This project contains the Service and Model Definitions. From this the Server and Client interfaces are generated for the Aroma Service.

There is a newer version: 2.2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package tech.aroma.thrift.authentication;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-10")
public class UserToken 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("UserToken");

  private static final org.apache.thrift.protocol.TField TOKEN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField TIME_OF_EXPIRATION_FIELD_DESC = new org.apache.thrift.protocol.TField("timeOfExpiration", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField ORGANIZATION_FIELD_DESC = new org.apache.thrift.protocol.TField("organization", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField IS_OAUTH_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("isOauthToken", org.apache.thrift.protocol.TType.BOOL, (short)4);
  private static final org.apache.thrift.protocol.TField OAUTH_PROVIDER_FIELD_DESC = new org.apache.thrift.protocol.TField("oauthProvider", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRING, (short)6);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new UserTokenStandardSchemeFactory());
    schemes.put(TupleScheme.class, new UserTokenTupleSchemeFactory());
  }

  public String tokenId; // required
  public long timeOfExpiration; // required
  public String organization; // optional
  public boolean isOauthToken; // optional
  public String oauthProvider; // optional
  public String userId; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    TOKEN_ID((short)1, "tokenId"),
    TIME_OF_EXPIRATION((short)2, "timeOfExpiration"),
    ORGANIZATION((short)3, "organization"),
    IS_OAUTH_TOKEN((short)4, "isOauthToken"),
    OAUTH_PROVIDER((short)5, "oauthProvider"),
    USER_ID((short)6, "userId");

    private static final Map byName = new HashMap();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // TOKEN_ID
          return TOKEN_ID;
        case 2: // TIME_OF_EXPIRATION
          return TIME_OF_EXPIRATION;
        case 3: // ORGANIZATION
          return ORGANIZATION;
        case 4: // IS_OAUTH_TOKEN
          return IS_OAUTH_TOKEN;
        case 5: // OAUTH_PROVIDER
          return OAUTH_PROVIDER;
        case 6: // USER_ID
          return USER_ID;
        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.
     */
    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 __TIMEOFEXPIRATION_ISSET_ID = 0;
  private static final int __ISOAUTHTOKEN_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.ORGANIZATION,_Fields.IS_OAUTH_TOKEN,_Fields.OAUTH_PROVIDER};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TOKEN_ID, new org.apache.thrift.meta_data.FieldMetaData("tokenId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TIME_OF_EXPIRATION, new org.apache.thrift.meta_data.FieldMetaData("timeOfExpiration", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "timestamp")));
    tmpMap.put(_Fields.ORGANIZATION, new org.apache.thrift.meta_data.FieldMetaData("organization", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IS_OAUTH_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("isOauthToken", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.OAUTH_PROVIDER, new org.apache.thrift.meta_data.FieldMetaData("oauthProvider", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "uuid")));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserToken.class, metaDataMap);
  }

  public UserToken() {
    this.isOauthToken = false;

  }

  public UserToken(
    String tokenId,
    long timeOfExpiration,
    String userId)
  {
    this();
    this.tokenId = tokenId;
    this.timeOfExpiration = timeOfExpiration;
    setTimeOfExpirationIsSet(true);
    this.userId = userId;
  }

  /**
   * Performs a deep copy on other.
   */
  public UserToken(UserToken other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetTokenId()) {
      this.tokenId = other.tokenId;
    }
    this.timeOfExpiration = other.timeOfExpiration;
    if (other.isSetOrganization()) {
      this.organization = other.organization;
    }
    this.isOauthToken = other.isOauthToken;
    if (other.isSetOauthProvider()) {
      this.oauthProvider = other.oauthProvider;
    }
    if (other.isSetUserId()) {
      this.userId = other.userId;
    }
  }

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

  @Override
  public void clear() {
    this.tokenId = null;
    setTimeOfExpirationIsSet(false);
    this.timeOfExpiration = 0;
    this.organization = null;
    this.isOauthToken = false;

    this.oauthProvider = null;
    this.userId = null;
  }

  public String getTokenId() {
    return this.tokenId;
  }

  public UserToken setTokenId(String tokenId) {
    this.tokenId = tokenId;
    return this;
  }

  public void unsetTokenId() {
    this.tokenId = null;
  }

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

  public void setTokenIdIsSet(boolean value) {
    if (!value) {
      this.tokenId = null;
    }
  }

  public long getTimeOfExpiration() {
    return this.timeOfExpiration;
  }

  public UserToken setTimeOfExpiration(long timeOfExpiration) {
    this.timeOfExpiration = timeOfExpiration;
    setTimeOfExpirationIsSet(true);
    return this;
  }

  public void unsetTimeOfExpiration() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMEOFEXPIRATION_ISSET_ID);
  }

  /** Returns true if field timeOfExpiration is set (has been assigned a value) and false otherwise */
  public boolean isSetTimeOfExpiration() {
    return EncodingUtils.testBit(__isset_bitfield, __TIMEOFEXPIRATION_ISSET_ID);
  }

  public void setTimeOfExpirationIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMEOFEXPIRATION_ISSET_ID, value);
  }

  public String getOrganization() {
    return this.organization;
  }

  public UserToken setOrganization(String organization) {
    this.organization = organization;
    return this;
  }

  public void unsetOrganization() {
    this.organization = null;
  }

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

  public void setOrganizationIsSet(boolean value) {
    if (!value) {
      this.organization = null;
    }
  }

  public boolean isIsOauthToken() {
    return this.isOauthToken;
  }

  public UserToken setIsOauthToken(boolean isOauthToken) {
    this.isOauthToken = isOauthToken;
    setIsOauthTokenIsSet(true);
    return this;
  }

  public void unsetIsOauthToken() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISOAUTHTOKEN_ISSET_ID);
  }

  /** Returns true if field isOauthToken is set (has been assigned a value) and false otherwise */
  public boolean isSetIsOauthToken() {
    return EncodingUtils.testBit(__isset_bitfield, __ISOAUTHTOKEN_ISSET_ID);
  }

  public void setIsOauthTokenIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISOAUTHTOKEN_ISSET_ID, value);
  }

  public String getOauthProvider() {
    return this.oauthProvider;
  }

  public UserToken setOauthProvider(String oauthProvider) {
    this.oauthProvider = oauthProvider;
    return this;
  }

  public void unsetOauthProvider() {
    this.oauthProvider = null;
  }

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

  public void setOauthProviderIsSet(boolean value) {
    if (!value) {
      this.oauthProvider = null;
    }
  }

  public String getUserId() {
    return this.userId;
  }

  public UserToken setUserId(String userId) {
    this.userId = userId;
    return this;
  }

  public void unsetUserId() {
    this.userId = null;
  }

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

  public void setUserIdIsSet(boolean value) {
    if (!value) {
      this.userId = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TOKEN_ID:
      if (value == null) {
        unsetTokenId();
      } else {
        setTokenId((String)value);
      }
      break;

    case TIME_OF_EXPIRATION:
      if (value == null) {
        unsetTimeOfExpiration();
      } else {
        setTimeOfExpiration((Long)value);
      }
      break;

    case ORGANIZATION:
      if (value == null) {
        unsetOrganization();
      } else {
        setOrganization((String)value);
      }
      break;

    case IS_OAUTH_TOKEN:
      if (value == null) {
        unsetIsOauthToken();
      } else {
        setIsOauthToken((Boolean)value);
      }
      break;

    case OAUTH_PROVIDER:
      if (value == null) {
        unsetOauthProvider();
      } else {
        setOauthProvider((String)value);
      }
      break;

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

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TOKEN_ID:
      return getTokenId();

    case TIME_OF_EXPIRATION:
      return getTimeOfExpiration();

    case ORGANIZATION:
      return getOrganization();

    case IS_OAUTH_TOKEN:
      return isIsOauthToken();

    case OAUTH_PROVIDER:
      return getOauthProvider();

    case USER_ID:
      return getUserId();

    }
    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 TOKEN_ID:
      return isSetTokenId();
    case TIME_OF_EXPIRATION:
      return isSetTimeOfExpiration();
    case ORGANIZATION:
      return isSetOrganization();
    case IS_OAUTH_TOKEN:
      return isSetIsOauthToken();
    case OAUTH_PROVIDER:
      return isSetOauthProvider();
    case USER_ID:
      return isSetUserId();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_tokenId = true && this.isSetTokenId();
    boolean that_present_tokenId = true && that.isSetTokenId();
    if (this_present_tokenId || that_present_tokenId) {
      if (!(this_present_tokenId && that_present_tokenId))
        return false;
      if (!this.tokenId.equals(that.tokenId))
        return false;
    }

    boolean this_present_timeOfExpiration = true;
    boolean that_present_timeOfExpiration = true;
    if (this_present_timeOfExpiration || that_present_timeOfExpiration) {
      if (!(this_present_timeOfExpiration && that_present_timeOfExpiration))
        return false;
      if (this.timeOfExpiration != that.timeOfExpiration)
        return false;
    }

    boolean this_present_organization = true && this.isSetOrganization();
    boolean that_present_organization = true && that.isSetOrganization();
    if (this_present_organization || that_present_organization) {
      if (!(this_present_organization && that_present_organization))
        return false;
      if (!this.organization.equals(that.organization))
        return false;
    }

    boolean this_present_isOauthToken = true && this.isSetIsOauthToken();
    boolean that_present_isOauthToken = true && that.isSetIsOauthToken();
    if (this_present_isOauthToken || that_present_isOauthToken) {
      if (!(this_present_isOauthToken && that_present_isOauthToken))
        return false;
      if (this.isOauthToken != that.isOauthToken)
        return false;
    }

    boolean this_present_oauthProvider = true && this.isSetOauthProvider();
    boolean that_present_oauthProvider = true && that.isSetOauthProvider();
    if (this_present_oauthProvider || that_present_oauthProvider) {
      if (!(this_present_oauthProvider && that_present_oauthProvider))
        return false;
      if (!this.oauthProvider.equals(that.oauthProvider))
        return false;
    }

    boolean this_present_userId = true && this.isSetUserId();
    boolean that_present_userId = true && that.isSetUserId();
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (!this.userId.equals(that.userId))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_tokenId = true && (isSetTokenId());
    list.add(present_tokenId);
    if (present_tokenId)
      list.add(tokenId);

    boolean present_timeOfExpiration = true;
    list.add(present_timeOfExpiration);
    if (present_timeOfExpiration)
      list.add(timeOfExpiration);

    boolean present_organization = true && (isSetOrganization());
    list.add(present_organization);
    if (present_organization)
      list.add(organization);

    boolean present_isOauthToken = true && (isSetIsOauthToken());
    list.add(present_isOauthToken);
    if (present_isOauthToken)
      list.add(isOauthToken);

    boolean present_oauthProvider = true && (isSetOauthProvider());
    list.add(present_oauthProvider);
    if (present_oauthProvider)
      list.add(oauthProvider);

    boolean present_userId = true && (isSetUserId());
    list.add(present_userId);
    if (present_userId)
      list.add(userId);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTokenId()).compareTo(other.isSetTokenId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTokenId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokenId, other.tokenId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeOfExpiration()).compareTo(other.isSetTimeOfExpiration());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeOfExpiration()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeOfExpiration, other.timeOfExpiration);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrganization()).compareTo(other.isSetOrganization());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrganization()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organization, other.organization);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsOauthToken()).compareTo(other.isSetIsOauthToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsOauthToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isOauthToken, other.isOauthToken);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOauthProvider()).compareTo(other.isSetOauthProvider());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOauthProvider()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oauthProvider, other.oauthProvider);
      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;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

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

    sb.append("tokenId:");
    if (this.tokenId == null) {
      sb.append("null");
    } else {
      sb.append(this.tokenId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeOfExpiration:");
    sb.append(this.timeOfExpiration);
    first = false;
    if (isSetOrganization()) {
      if (!first) sb.append(", ");
      sb.append("organization:");
      if (this.organization == null) {
        sb.append("null");
      } else {
        sb.append(this.organization);
      }
      first = false;
    }
    if (isSetIsOauthToken()) {
      if (!first) sb.append(", ");
      sb.append("isOauthToken:");
      sb.append(this.isOauthToken);
      first = false;
    }
    if (isSetOauthProvider()) {
      if (!first) sb.append(", ");
      sb.append("oauthProvider:");
      if (this.oauthProvider == null) {
        sb.append("null");
      } else {
        sb.append(this.oauthProvider);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("userId:");
    if (this.userId == null) {
      sb.append("null");
    } else {
      sb.append(this.userId);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // 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 UserTokenStandardSchemeFactory implements SchemeFactory {
    public UserTokenStandardScheme getScheme() {
      return new UserTokenStandardScheme();
    }
  }

  private static class UserTokenStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, UserToken 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: // TOKEN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tokenId = iprot.readString();
              struct.setTokenIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TIME_OF_EXPIRATION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeOfExpiration = iprot.readI64();
              struct.setTimeOfExpirationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // ORGANIZATION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.organization = iprot.readString();
              struct.setOrganizationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // IS_OAUTH_TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isOauthToken = iprot.readBool();
              struct.setIsOauthTokenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // OAUTH_PROVIDER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.oauthProvider = iprot.readString();
              struct.setOauthProviderIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // USER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.userId = iprot.readString();
              struct.setUserIdIsSet(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
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.tokenId != null) {
        oprot.writeFieldBegin(TOKEN_ID_FIELD_DESC);
        oprot.writeString(struct.tokenId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIME_OF_EXPIRATION_FIELD_DESC);
      oprot.writeI64(struct.timeOfExpiration);
      oprot.writeFieldEnd();
      if (struct.organization != null) {
        if (struct.isSetOrganization()) {
          oprot.writeFieldBegin(ORGANIZATION_FIELD_DESC);
          oprot.writeString(struct.organization);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIsOauthToken()) {
        oprot.writeFieldBegin(IS_OAUTH_TOKEN_FIELD_DESC);
        oprot.writeBool(struct.isOauthToken);
        oprot.writeFieldEnd();
      }
      if (struct.oauthProvider != null) {
        if (struct.isSetOauthProvider()) {
          oprot.writeFieldBegin(OAUTH_PROVIDER_FIELD_DESC);
          oprot.writeString(struct.oauthProvider);
          oprot.writeFieldEnd();
        }
      }
      if (struct.userId != null) {
        oprot.writeFieldBegin(USER_ID_FIELD_DESC);
        oprot.writeString(struct.userId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class UserTokenTupleSchemeFactory implements SchemeFactory {
    public UserTokenTupleScheme getScheme() {
      return new UserTokenTupleScheme();
    }
  }

  private static class UserTokenTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, UserToken struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTokenId()) {
        optionals.set(0);
      }
      if (struct.isSetTimeOfExpiration()) {
        optionals.set(1);
      }
      if (struct.isSetOrganization()) {
        optionals.set(2);
      }
      if (struct.isSetIsOauthToken()) {
        optionals.set(3);
      }
      if (struct.isSetOauthProvider()) {
        optionals.set(4);
      }
      if (struct.isSetUserId()) {
        optionals.set(5);
      }
      oprot.writeBitSet(optionals, 6);
      if (struct.isSetTokenId()) {
        oprot.writeString(struct.tokenId);
      }
      if (struct.isSetTimeOfExpiration()) {
        oprot.writeI64(struct.timeOfExpiration);
      }
      if (struct.isSetOrganization()) {
        oprot.writeString(struct.organization);
      }
      if (struct.isSetIsOauthToken()) {
        oprot.writeBool(struct.isOauthToken);
      }
      if (struct.isSetOauthProvider()) {
        oprot.writeString(struct.oauthProvider);
      }
      if (struct.isSetUserId()) {
        oprot.writeString(struct.userId);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, UserToken struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(6);
      if (incoming.get(0)) {
        struct.tokenId = iprot.readString();
        struct.setTokenIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.timeOfExpiration = iprot.readI64();
        struct.setTimeOfExpirationIsSet(true);
      }
      if (incoming.get(2)) {
        struct.organization = iprot.readString();
        struct.setOrganizationIsSet(true);
      }
      if (incoming.get(3)) {
        struct.isOauthToken = iprot.readBool();
        struct.setIsOauthTokenIsSet(true);
      }
      if (incoming.get(4)) {
        struct.oauthProvider = iprot.readString();
        struct.setOauthProviderIsSet(true);
      }
      if (incoming.get(5)) {
        struct.userId = iprot.readString();
        struct.setUserIdIsSet(true);
      }
    }
  }

}