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

tech.aroma.thrift.authentication.AuthenticationToken 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"})
/**
 * Represents an Authentication Token that is used
 * and accepted by the Authentication Service.
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-10")
public class AuthenticationToken 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("AuthenticationToken");

  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 OWNER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField TIME_OF_CREATION_FIELD_DESC = new org.apache.thrift.protocol.TField("timeOfCreation", org.apache.thrift.protocol.TType.I64, (short)3);
  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)4);
  private static final org.apache.thrift.protocol.TField TOKEN_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tokenType", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField ORGANIZATION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("organizationId", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField OWNER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerName", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField ORGANIZATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("organizationName", org.apache.thrift.protocol.TType.STRING, (short)8);

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

  public String tokenId; // required
  public String ownerId; // required
  public long timeOfCreation; // required
  public long timeOfExpiration; // required
  /**
   * 
   * @see TokenType
   */
  public TokenType tokenType; // required
  public String organizationId; // required
  public String ownerName; // required
  public String organizationName; // 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"),
    OWNER_ID((short)2, "ownerId"),
    TIME_OF_CREATION((short)3, "timeOfCreation"),
    TIME_OF_EXPIRATION((short)4, "timeOfExpiration"),
    /**
     * 
     * @see TokenType
     */
    TOKEN_TYPE((short)5, "tokenType"),
    ORGANIZATION_ID((short)6, "organizationId"),
    OWNER_NAME((short)7, "ownerName"),
    ORGANIZATION_NAME((short)8, "organizationName");

    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: // OWNER_ID
          return OWNER_ID;
        case 3: // TIME_OF_CREATION
          return TIME_OF_CREATION;
        case 4: // TIME_OF_EXPIRATION
          return TIME_OF_EXPIRATION;
        case 5: // TOKEN_TYPE
          return TOKEN_TYPE;
        case 6: // ORGANIZATION_ID
          return ORGANIZATION_ID;
        case 7: // OWNER_NAME
          return OWNER_NAME;
        case 8: // ORGANIZATION_NAME
          return ORGANIZATION_NAME;
        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 __TIMEOFCREATION_ISSET_ID = 0;
  private static final int __TIMEOFEXPIRATION_ISSET_ID = 1;
  private byte __isset_bitfield = 0;
  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.OWNER_ID, new org.apache.thrift.meta_data.FieldMetaData("ownerId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "uuid")));
    tmpMap.put(_Fields.TIME_OF_CREATION, new org.apache.thrift.meta_data.FieldMetaData("timeOfCreation", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "timestamp")));
    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.TOKEN_TYPE, new org.apache.thrift.meta_data.FieldMetaData("tokenType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TokenType.class)));
    tmpMap.put(_Fields.ORGANIZATION_ID, new org.apache.thrift.meta_data.FieldMetaData("organizationId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "uuid")));
    tmpMap.put(_Fields.OWNER_NAME, new org.apache.thrift.meta_data.FieldMetaData("ownerName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ORGANIZATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("organizationName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationToken.class, metaDataMap);
  }

  public AuthenticationToken() {
  }

  public AuthenticationToken(
    String tokenId,
    String ownerId,
    long timeOfCreation,
    long timeOfExpiration,
    TokenType tokenType,
    String organizationId,
    String ownerName,
    String organizationName)
  {
    this();
    this.tokenId = tokenId;
    this.ownerId = ownerId;
    this.timeOfCreation = timeOfCreation;
    setTimeOfCreationIsSet(true);
    this.timeOfExpiration = timeOfExpiration;
    setTimeOfExpirationIsSet(true);
    this.tokenType = tokenType;
    this.organizationId = organizationId;
    this.ownerName = ownerName;
    this.organizationName = organizationName;
  }

  /**
   * Performs a deep copy on other.
   */
  public AuthenticationToken(AuthenticationToken other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetTokenId()) {
      this.tokenId = other.tokenId;
    }
    if (other.isSetOwnerId()) {
      this.ownerId = other.ownerId;
    }
    this.timeOfCreation = other.timeOfCreation;
    this.timeOfExpiration = other.timeOfExpiration;
    if (other.isSetTokenType()) {
      this.tokenType = other.tokenType;
    }
    if (other.isSetOrganizationId()) {
      this.organizationId = other.organizationId;
    }
    if (other.isSetOwnerName()) {
      this.ownerName = other.ownerName;
    }
    if (other.isSetOrganizationName()) {
      this.organizationName = other.organizationName;
    }
  }

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

  @Override
  public void clear() {
    this.tokenId = null;
    this.ownerId = null;
    setTimeOfCreationIsSet(false);
    this.timeOfCreation = 0;
    setTimeOfExpirationIsSet(false);
    this.timeOfExpiration = 0;
    this.tokenType = null;
    this.organizationId = null;
    this.ownerName = null;
    this.organizationName = null;
  }

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

  public AuthenticationToken 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 String getOwnerId() {
    return this.ownerId;
  }

  public AuthenticationToken setOwnerId(String ownerId) {
    this.ownerId = ownerId;
    return this;
  }

  public void unsetOwnerId() {
    this.ownerId = null;
  }

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

  public void setOwnerIdIsSet(boolean value) {
    if (!value) {
      this.ownerId = null;
    }
  }

  public long getTimeOfCreation() {
    return this.timeOfCreation;
  }

  public AuthenticationToken setTimeOfCreation(long timeOfCreation) {
    this.timeOfCreation = timeOfCreation;
    setTimeOfCreationIsSet(true);
    return this;
  }

  public void unsetTimeOfCreation() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMEOFCREATION_ISSET_ID);
  }

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

  public void setTimeOfCreationIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMEOFCREATION_ISSET_ID, value);
  }

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

  public AuthenticationToken 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);
  }

  /**
   * 
   * @see TokenType
   */
  public TokenType getTokenType() {
    return this.tokenType;
  }

  /**
   * 
   * @see TokenType
   */
  public AuthenticationToken setTokenType(TokenType tokenType) {
    this.tokenType = tokenType;
    return this;
  }

  public void unsetTokenType() {
    this.tokenType = null;
  }

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

  public void setTokenTypeIsSet(boolean value) {
    if (!value) {
      this.tokenType = null;
    }
  }

  public String getOrganizationId() {
    return this.organizationId;
  }

  public AuthenticationToken setOrganizationId(String organizationId) {
    this.organizationId = organizationId;
    return this;
  }

  public void unsetOrganizationId() {
    this.organizationId = null;
  }

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

  public void setOrganizationIdIsSet(boolean value) {
    if (!value) {
      this.organizationId = null;
    }
  }

  public String getOwnerName() {
    return this.ownerName;
  }

  public AuthenticationToken setOwnerName(String ownerName) {
    this.ownerName = ownerName;
    return this;
  }

  public void unsetOwnerName() {
    this.ownerName = null;
  }

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

  public void setOwnerNameIsSet(boolean value) {
    if (!value) {
      this.ownerName = null;
    }
  }

  public String getOrganizationName() {
    return this.organizationName;
  }

  public AuthenticationToken setOrganizationName(String organizationName) {
    this.organizationName = organizationName;
    return this;
  }

  public void unsetOrganizationName() {
    this.organizationName = null;
  }

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

  public void setOrganizationNameIsSet(boolean value) {
    if (!value) {
      this.organizationName = null;
    }
  }

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

    case OWNER_ID:
      if (value == null) {
        unsetOwnerId();
      } else {
        setOwnerId((String)value);
      }
      break;

    case TIME_OF_CREATION:
      if (value == null) {
        unsetTimeOfCreation();
      } else {
        setTimeOfCreation((Long)value);
      }
      break;

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

    case TOKEN_TYPE:
      if (value == null) {
        unsetTokenType();
      } else {
        setTokenType((TokenType)value);
      }
      break;

    case ORGANIZATION_ID:
      if (value == null) {
        unsetOrganizationId();
      } else {
        setOrganizationId((String)value);
      }
      break;

    case OWNER_NAME:
      if (value == null) {
        unsetOwnerName();
      } else {
        setOwnerName((String)value);
      }
      break;

    case ORGANIZATION_NAME:
      if (value == null) {
        unsetOrganizationName();
      } else {
        setOrganizationName((String)value);
      }
      break;

    }
  }

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

    case OWNER_ID:
      return getOwnerId();

    case TIME_OF_CREATION:
      return getTimeOfCreation();

    case TIME_OF_EXPIRATION:
      return getTimeOfExpiration();

    case TOKEN_TYPE:
      return getTokenType();

    case ORGANIZATION_ID:
      return getOrganizationId();

    case OWNER_NAME:
      return getOwnerName();

    case ORGANIZATION_NAME:
      return getOrganizationName();

    }
    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 OWNER_ID:
      return isSetOwnerId();
    case TIME_OF_CREATION:
      return isSetTimeOfCreation();
    case TIME_OF_EXPIRATION:
      return isSetTimeOfExpiration();
    case TOKEN_TYPE:
      return isSetTokenType();
    case ORGANIZATION_ID:
      return isSetOrganizationId();
    case OWNER_NAME:
      return isSetOwnerName();
    case ORGANIZATION_NAME:
      return isSetOrganizationName();
    }
    throw new IllegalStateException();
  }

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

  public boolean equals(AuthenticationToken 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_ownerId = true && this.isSetOwnerId();
    boolean that_present_ownerId = true && that.isSetOwnerId();
    if (this_present_ownerId || that_present_ownerId) {
      if (!(this_present_ownerId && that_present_ownerId))
        return false;
      if (!this.ownerId.equals(that.ownerId))
        return false;
    }

    boolean this_present_timeOfCreation = true;
    boolean that_present_timeOfCreation = true;
    if (this_present_timeOfCreation || that_present_timeOfCreation) {
      if (!(this_present_timeOfCreation && that_present_timeOfCreation))
        return false;
      if (this.timeOfCreation != that.timeOfCreation)
        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_tokenType = true && this.isSetTokenType();
    boolean that_present_tokenType = true && that.isSetTokenType();
    if (this_present_tokenType || that_present_tokenType) {
      if (!(this_present_tokenType && that_present_tokenType))
        return false;
      if (!this.tokenType.equals(that.tokenType))
        return false;
    }

    boolean this_present_organizationId = true && this.isSetOrganizationId();
    boolean that_present_organizationId = true && that.isSetOrganizationId();
    if (this_present_organizationId || that_present_organizationId) {
      if (!(this_present_organizationId && that_present_organizationId))
        return false;
      if (!this.organizationId.equals(that.organizationId))
        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;
    }

    boolean this_present_organizationName = true && this.isSetOrganizationName();
    boolean that_present_organizationName = true && that.isSetOrganizationName();
    if (this_present_organizationName || that_present_organizationName) {
      if (!(this_present_organizationName && that_present_organizationName))
        return false;
      if (!this.organizationName.equals(that.organizationName))
        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_ownerId = true && (isSetOwnerId());
    list.add(present_ownerId);
    if (present_ownerId)
      list.add(ownerId);

    boolean present_timeOfCreation = true;
    list.add(present_timeOfCreation);
    if (present_timeOfCreation)
      list.add(timeOfCreation);

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

    boolean present_tokenType = true && (isSetTokenType());
    list.add(present_tokenType);
    if (present_tokenType)
      list.add(tokenType.getValue());

    boolean present_organizationId = true && (isSetOrganizationId());
    list.add(present_organizationId);
    if (present_organizationId)
      list.add(organizationId);

    boolean present_ownerName = true && (isSetOwnerName());
    list.add(present_ownerName);
    if (present_ownerName)
      list.add(ownerName);

    boolean present_organizationName = true && (isSetOrganizationName());
    list.add(present_organizationName);
    if (present_organizationName)
      list.add(organizationName);

    return list.hashCode();
  }

  @Override
  public int compareTo(AuthenticationToken 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(isSetOwnerId()).compareTo(other.isSetOwnerId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOwnerId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ownerId, other.ownerId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeOfCreation()).compareTo(other.isSetTimeOfCreation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeOfCreation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeOfCreation, other.timeOfCreation);
      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(isSetTokenType()).compareTo(other.isSetTokenType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTokenType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokenType, other.tokenType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrganizationId()).compareTo(other.isSetOrganizationId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrganizationId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organizationId, other.organizationId);
      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;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrganizationName()).compareTo(other.isSetOrganizationName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrganizationName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organizationName, other.organizationName);
      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("AuthenticationToken(");
    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("ownerId:");
    if (this.ownerId == null) {
      sb.append("null");
    } else {
      sb.append(this.ownerId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeOfCreation:");
    sb.append(this.timeOfCreation);
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeOfExpiration:");
    sb.append(this.timeOfExpiration);
    first = false;
    if (!first) sb.append(", ");
    sb.append("tokenType:");
    if (this.tokenType == null) {
      sb.append("null");
    } else {
      sb.append(this.tokenType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("organizationId:");
    if (this.organizationId == null) {
      sb.append("null");
    } else {
      sb.append(this.organizationId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("ownerName:");
    if (this.ownerName == null) {
      sb.append("null");
    } else {
      sb.append(this.ownerName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("organizationName:");
    if (this.organizationName == null) {
      sb.append("null");
    } else {
      sb.append(this.organizationName);
    }
    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 AuthenticationTokenStandardSchemeFactory implements SchemeFactory {
    public AuthenticationTokenStandardScheme getScheme() {
      return new AuthenticationTokenStandardScheme();
    }
  }

  private static class AuthenticationTokenStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationToken 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: // OWNER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.ownerId = iprot.readString();
              struct.setOwnerIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TIME_OF_CREATION
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeOfCreation = iprot.readI64();
              struct.setTimeOfCreationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // 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 5: // TOKEN_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.tokenType = tech.aroma.thrift.authentication.TokenType.findByValue(iprot.readI32());
              struct.setTokenTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // ORGANIZATION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.organizationId = iprot.readString();
              struct.setOrganizationIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // 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;
          case 8: // ORGANIZATION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.organizationName = iprot.readString();
              struct.setOrganizationNameIsSet(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, AuthenticationToken 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();
      }
      if (struct.ownerId != null) {
        oprot.writeFieldBegin(OWNER_ID_FIELD_DESC);
        oprot.writeString(struct.ownerId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIME_OF_CREATION_FIELD_DESC);
      oprot.writeI64(struct.timeOfCreation);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIME_OF_EXPIRATION_FIELD_DESC);
      oprot.writeI64(struct.timeOfExpiration);
      oprot.writeFieldEnd();
      if (struct.tokenType != null) {
        oprot.writeFieldBegin(TOKEN_TYPE_FIELD_DESC);
        oprot.writeI32(struct.tokenType.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.organizationId != null) {
        oprot.writeFieldBegin(ORGANIZATION_ID_FIELD_DESC);
        oprot.writeString(struct.organizationId);
        oprot.writeFieldEnd();
      }
      if (struct.ownerName != null) {
        oprot.writeFieldBegin(OWNER_NAME_FIELD_DESC);
        oprot.writeString(struct.ownerName);
        oprot.writeFieldEnd();
      }
      if (struct.organizationName != null) {
        oprot.writeFieldBegin(ORGANIZATION_NAME_FIELD_DESC);
        oprot.writeString(struct.organizationName);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class AuthenticationTokenTupleSchemeFactory implements SchemeFactory {
    public AuthenticationTokenTupleScheme getScheme() {
      return new AuthenticationTokenTupleScheme();
    }
  }

  private static class AuthenticationTokenTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationToken struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTokenId()) {
        optionals.set(0);
      }
      if (struct.isSetOwnerId()) {
        optionals.set(1);
      }
      if (struct.isSetTimeOfCreation()) {
        optionals.set(2);
      }
      if (struct.isSetTimeOfExpiration()) {
        optionals.set(3);
      }
      if (struct.isSetTokenType()) {
        optionals.set(4);
      }
      if (struct.isSetOrganizationId()) {
        optionals.set(5);
      }
      if (struct.isSetOwnerName()) {
        optionals.set(6);
      }
      if (struct.isSetOrganizationName()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetTokenId()) {
        oprot.writeString(struct.tokenId);
      }
      if (struct.isSetOwnerId()) {
        oprot.writeString(struct.ownerId);
      }
      if (struct.isSetTimeOfCreation()) {
        oprot.writeI64(struct.timeOfCreation);
      }
      if (struct.isSetTimeOfExpiration()) {
        oprot.writeI64(struct.timeOfExpiration);
      }
      if (struct.isSetTokenType()) {
        oprot.writeI32(struct.tokenType.getValue());
      }
      if (struct.isSetOrganizationId()) {
        oprot.writeString(struct.organizationId);
      }
      if (struct.isSetOwnerName()) {
        oprot.writeString(struct.ownerName);
      }
      if (struct.isSetOrganizationName()) {
        oprot.writeString(struct.organizationName);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationToken struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.tokenId = iprot.readString();
        struct.setTokenIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.ownerId = iprot.readString();
        struct.setOwnerIdIsSet(true);
      }
      if (incoming.get(2)) {
        struct.timeOfCreation = iprot.readI64();
        struct.setTimeOfCreationIsSet(true);
      }
      if (incoming.get(3)) {
        struct.timeOfExpiration = iprot.readI64();
        struct.setTimeOfExpirationIsSet(true);
      }
      if (incoming.get(4)) {
        struct.tokenType = tech.aroma.thrift.authentication.TokenType.findByValue(iprot.readI32());
        struct.setTokenTypeIsSet(true);
      }
      if (incoming.get(5)) {
        struct.organizationId = iprot.readString();
        struct.setOrganizationIdIsSet(true);
      }
      if (incoming.get(6)) {
        struct.ownerName = iprot.readString();
        struct.setOwnerNameIsSet(true);
      }
      if (incoming.get(7)) {
        struct.organizationName = iprot.readString();
        struct.setOrganizationNameIsSet(true);
      }
    }
  }

}