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

com.uber.cadence.GetWorkflowExecutionHistoryResponse Maven / Gradle / Ivy

There is a newer version: 3.12.5
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 com.uber.cadence;

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 = "2019-06-18")
public class GetWorkflowExecutionHistoryResponse 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("GetWorkflowExecutionHistoryResponse");

  private static final org.apache.thrift.protocol.TField HISTORY_FIELD_DESC = new org.apache.thrift.protocol.TField("history", org.apache.thrift.protocol.TType.STRUCT, (short)10);
  private static final org.apache.thrift.protocol.TField NEXT_PAGE_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("nextPageToken", org.apache.thrift.protocol.TType.STRING, (short)20);
  private static final org.apache.thrift.protocol.TField ARCHIVED_FIELD_DESC = new org.apache.thrift.protocol.TField("archived", org.apache.thrift.protocol.TType.BOOL, (short)30);

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

  public History history; // optional
  public ByteBuffer nextPageToken; // optional
  public boolean archived; // 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 {
    HISTORY((short)10, "history"),
    NEXT_PAGE_TOKEN((short)20, "nextPageToken"),
    ARCHIVED((short)30, "archived");

    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 10: // HISTORY
          return HISTORY;
        case 20: // NEXT_PAGE_TOKEN
          return NEXT_PAGE_TOKEN;
        case 30: // ARCHIVED
          return ARCHIVED;
        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 __ARCHIVED_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.HISTORY,_Fields.NEXT_PAGE_TOKEN,_Fields.ARCHIVED};
  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.HISTORY, new org.apache.thrift.meta_data.FieldMetaData("history", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, History.class)));
    tmpMap.put(_Fields.NEXT_PAGE_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("nextPageToken", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.ARCHIVED, new org.apache.thrift.meta_data.FieldMetaData("archived", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GetWorkflowExecutionHistoryResponse.class, metaDataMap);
  }

  public GetWorkflowExecutionHistoryResponse() {
  }

  /**
   * Performs a deep copy on other.
   */
  public GetWorkflowExecutionHistoryResponse(GetWorkflowExecutionHistoryResponse other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetHistory()) {
      this.history = new History(other.history);
    }
    if (other.isSetNextPageToken()) {
      this.nextPageToken = org.apache.thrift.TBaseHelper.copyBinary(other.nextPageToken);
    }
    this.archived = other.archived;
  }

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

  @Override
  public void clear() {
    this.history = null;
    this.nextPageToken = null;
    setArchivedIsSet(false);
    this.archived = false;
  }

  public History getHistory() {
    return this.history;
  }

  public GetWorkflowExecutionHistoryResponse setHistory(History history) {
    this.history = history;
    return this;
  }

  public void unsetHistory() {
    this.history = null;
  }

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

  public void setHistoryIsSet(boolean value) {
    if (!value) {
      this.history = null;
    }
  }

  public byte[] getNextPageToken() {
    setNextPageToken(org.apache.thrift.TBaseHelper.rightSize(nextPageToken));
    return nextPageToken == null ? null : nextPageToken.array();
  }

  public ByteBuffer bufferForNextPageToken() {
    return org.apache.thrift.TBaseHelper.copyBinary(nextPageToken);
  }

  public GetWorkflowExecutionHistoryResponse setNextPageToken(byte[] nextPageToken) {
    this.nextPageToken = nextPageToken == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(nextPageToken, nextPageToken.length));
    return this;
  }

  public GetWorkflowExecutionHistoryResponse setNextPageToken(ByteBuffer nextPageToken) {
    this.nextPageToken = org.apache.thrift.TBaseHelper.copyBinary(nextPageToken);
    return this;
  }

  public void unsetNextPageToken() {
    this.nextPageToken = null;
  }

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

  public void setNextPageTokenIsSet(boolean value) {
    if (!value) {
      this.nextPageToken = null;
    }
  }

  public boolean isArchived() {
    return this.archived;
  }

  public GetWorkflowExecutionHistoryResponse setArchived(boolean archived) {
    this.archived = archived;
    setArchivedIsSet(true);
    return this;
  }

  public void unsetArchived() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ARCHIVED_ISSET_ID);
  }

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

  public void setArchivedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ARCHIVED_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case HISTORY:
      if (value == null) {
        unsetHistory();
      } else {
        setHistory((History)value);
      }
      break;

    case NEXT_PAGE_TOKEN:
      if (value == null) {
        unsetNextPageToken();
      } else {
        setNextPageToken((ByteBuffer)value);
      }
      break;

    case ARCHIVED:
      if (value == null) {
        unsetArchived();
      } else {
        setArchived((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case HISTORY:
      return getHistory();

    case NEXT_PAGE_TOKEN:
      return getNextPageToken();

    case ARCHIVED:
      return isArchived();

    }
    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 HISTORY:
      return isSetHistory();
    case NEXT_PAGE_TOKEN:
      return isSetNextPageToken();
    case ARCHIVED:
      return isSetArchived();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_history = true && this.isSetHistory();
    boolean that_present_history = true && that.isSetHistory();
    if (this_present_history || that_present_history) {
      if (!(this_present_history && that_present_history))
        return false;
      if (!this.history.equals(that.history))
        return false;
    }

    boolean this_present_nextPageToken = true && this.isSetNextPageToken();
    boolean that_present_nextPageToken = true && that.isSetNextPageToken();
    if (this_present_nextPageToken || that_present_nextPageToken) {
      if (!(this_present_nextPageToken && that_present_nextPageToken))
        return false;
      if (!this.nextPageToken.equals(that.nextPageToken))
        return false;
    }

    boolean this_present_archived = true && this.isSetArchived();
    boolean that_present_archived = true && that.isSetArchived();
    if (this_present_archived || that_present_archived) {
      if (!(this_present_archived && that_present_archived))
        return false;
      if (this.archived != that.archived)
        return false;
    }

    return true;
  }

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

    boolean present_history = true && (isSetHistory());
    list.add(present_history);
    if (present_history)
      list.add(history);

    boolean present_nextPageToken = true && (isSetNextPageToken());
    list.add(present_nextPageToken);
    if (present_nextPageToken)
      list.add(nextPageToken);

    boolean present_archived = true && (isSetArchived());
    list.add(present_archived);
    if (present_archived)
      list.add(archived);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetHistory()).compareTo(other.isSetHistory());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHistory()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.history, other.history);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNextPageToken()).compareTo(other.isSetNextPageToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNextPageToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nextPageToken, other.nextPageToken);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetArchived()).compareTo(other.isSetArchived());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetArchived()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.archived, other.archived);
      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("GetWorkflowExecutionHistoryResponse(");
    boolean first = true;

    if (isSetHistory()) {
      sb.append("history:");
      if (this.history == null) {
        sb.append("null");
      } else {
        sb.append(this.history);
      }
      first = false;
    }
    if (isSetNextPageToken()) {
      if (!first) sb.append(", ");
      sb.append("nextPageToken:");
      if (this.nextPageToken == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.nextPageToken, sb);
      }
      first = false;
    }
    if (isSetArchived()) {
      if (!first) sb.append(", ");
      sb.append("archived:");
      sb.append(this.archived);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (history != null) {
      history.validate();
    }
  }

  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 GetWorkflowExecutionHistoryResponseStandardSchemeFactory implements SchemeFactory {
    public GetWorkflowExecutionHistoryResponseStandardScheme getScheme() {
      return new GetWorkflowExecutionHistoryResponseStandardScheme();
    }
  }

  private static class GetWorkflowExecutionHistoryResponseStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, GetWorkflowExecutionHistoryResponse 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 10: // HISTORY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.history = new History();
              struct.history.read(iprot);
              struct.setHistoryIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // NEXT_PAGE_TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.nextPageToken = iprot.readBinary();
              struct.setNextPageTokenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // ARCHIVED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.archived = iprot.readBool();
              struct.setArchivedIsSet(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, GetWorkflowExecutionHistoryResponse struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.history != null) {
        if (struct.isSetHistory()) {
          oprot.writeFieldBegin(HISTORY_FIELD_DESC);
          struct.history.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.nextPageToken != null) {
        if (struct.isSetNextPageToken()) {
          oprot.writeFieldBegin(NEXT_PAGE_TOKEN_FIELD_DESC);
          oprot.writeBinary(struct.nextPageToken);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetArchived()) {
        oprot.writeFieldBegin(ARCHIVED_FIELD_DESC);
        oprot.writeBool(struct.archived);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class GetWorkflowExecutionHistoryResponseTupleSchemeFactory implements SchemeFactory {
    public GetWorkflowExecutionHistoryResponseTupleScheme getScheme() {
      return new GetWorkflowExecutionHistoryResponseTupleScheme();
    }
  }

  private static class GetWorkflowExecutionHistoryResponseTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, GetWorkflowExecutionHistoryResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetHistory()) {
        optionals.set(0);
      }
      if (struct.isSetNextPageToken()) {
        optionals.set(1);
      }
      if (struct.isSetArchived()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetHistory()) {
        struct.history.write(oprot);
      }
      if (struct.isSetNextPageToken()) {
        oprot.writeBinary(struct.nextPageToken);
      }
      if (struct.isSetArchived()) {
        oprot.writeBool(struct.archived);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, GetWorkflowExecutionHistoryResponse struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.history = new History();
        struct.history.read(iprot);
        struct.setHistoryIsSet(true);
      }
      if (incoming.get(1)) {
        struct.nextPageToken = iprot.readBinary();
        struct.setNextPageTokenIsSet(true);
      }
      if (incoming.get(2)) {
        struct.archived = iprot.readBool();
        struct.setArchivedIsSet(true);
      }
    }
  }

}