Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.alert;

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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AlertedEntity implements org.apache.thrift.TBase<AlertedEntity, AlertedEntity._Fields>, java.io.Serializable, Cloneable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AlertedEntity");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField ENTITY_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("entityType", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField EVENT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("eventType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField ENTITY_IDENTIFIER_FIELD_DESC = new org.apache.thrift.protocol.TField("entityIdentifier", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField ENTITY_PROCESSED_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("entityProcessedState", org.apache.thrift.protocol.TType.I32, (short)6);
  private static final org.apache.thrift.protocol.TField LAST_ALERTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastAlertedTime", org.apache.thrift.protocol.TType.I64, (short)7);

  private long id; // required
  private EntityType entityType; // required
  private int eventType; // required
  private String entityIdentifier; // required
  private String description; // required
  private EntityProcessedState entityProcessedState; // required
  private long lastAlertedTime; // 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 {
    ID((short)1, "id"),
    /**
     * 
     * @see EntityType
     */
    ENTITY_TYPE((short)2, "entityType"),
    EVENT_TYPE((short)3, "eventType"),
    ENTITY_IDENTIFIER((short)4, "entityIdentifier"),
    DESCRIPTION((short)5, "description"),
    /**
     * 
     * @see EntityProcessedState
     */
    ENTITY_PROCESSED_STATE((short)6, "entityProcessedState"),
    LAST_ALERTED_TIME((short)7, "lastAlertedTime");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    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: // ID
          return ID;
        case 2: // ENTITY_TYPE
          return ENTITY_TYPE;
        case 3: // EVENT_TYPE
          return EVENT_TYPE;
        case 4: // ENTITY_IDENTIFIER
          return ENTITY_IDENTIFIER;
        case 5: // DESCRIPTION
          return DESCRIPTION;
        case 6: // ENTITY_PROCESSED_STATE
          return ENTITY_PROCESSED_STATE;
        case 7: // LAST_ALERTED_TIME
          return LAST_ALERTED_TIME;
        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 __ID_ISSET_ID = 0;
  private static final int __EVENTTYPE_ISSET_ID = 1;
  private static final int __LASTALERTEDTIME_ISSET_ID = 2;
  private BitSet __isset_bit_vector = new BitSet(3);

  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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ENTITY_TYPE, new org.apache.thrift.meta_data.FieldMetaData("entityType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, EntityType.class)));
    tmpMap.put(_Fields.EVENT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("eventType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.ENTITY_IDENTIFIER, new org.apache.thrift.meta_data.FieldMetaData("entityIdentifier", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ENTITY_PROCESSED_STATE, new org.apache.thrift.meta_data.FieldMetaData("entityProcessedState", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, EntityProcessedState.class)));
    tmpMap.put(_Fields.LAST_ALERTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("lastAlertedTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AlertedEntity.class, metaDataMap);
  }

  public AlertedEntity() {
  }

  public AlertedEntity(
    long id,
    EntityType entityType,
    int eventType,
    String entityIdentifier,
    String description,
    EntityProcessedState entityProcessedState,
    long lastAlertedTime)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.entityType = entityType;
    this.eventType = eventType;
    setEventTypeIsSet(true);
    this.entityIdentifier = entityIdentifier;
    this.description = description;
    this.entityProcessedState = entityProcessedState;
    this.lastAlertedTime = lastAlertedTime;
    setLastAlertedTimeIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public AlertedEntity(AlertedEntity other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    if (other.isSetEntityType()) {
      this.entityType = other.entityType;
    }
    this.eventType = other.eventType;
    if (other.isSetEntityIdentifier()) {
      this.entityIdentifier = other.entityIdentifier;
    }
    if (other.isSetDescription()) {
      this.description = other.description;
    }
    if (other.isSetEntityProcessedState()) {
      this.entityProcessedState = other.entityProcessedState;
    }
    this.lastAlertedTime = other.lastAlertedTime;
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    this.entityType = null;
    setEventTypeIsSet(false);
    this.eventType = 0;
    this.entityIdentifier = null;
    this.description = null;
    this.entityProcessedState = null;
    setLastAlertedTimeIsSet(false);
    this.lastAlertedTime = 0;
  }

  public long getId() {
    return this.id;
  }

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  /**
   * 
   * @see EntityType
   */
  public EntityType getEntityType() {
    return this.entityType;
  }

  /**
   * 
   * @see EntityType
   */
  public void setEntityType(EntityType entityType) {
    this.entityType = entityType;
  }

  public void unsetEntityType() {
    this.entityType = null;
  }

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

  public void setEntityTypeIsSet(boolean value) {
    if (!value) {
      this.entityType = null;
    }
  }

  public int getEventType() {
    return this.eventType;
  }

  public void setEventType(int eventType) {
    this.eventType = eventType;
    setEventTypeIsSet(true);
  }

  public void unsetEventType() {
    __isset_bit_vector.clear(__EVENTTYPE_ISSET_ID);
  }

  /** Returns true if field eventType is set (has been assigned a value) and false otherwise */
  public boolean isSetEventType() {
    return __isset_bit_vector.get(__EVENTTYPE_ISSET_ID);
  }

  public void setEventTypeIsSet(boolean value) {
    __isset_bit_vector.set(__EVENTTYPE_ISSET_ID, value);
  }

  public String getEntityIdentifier() {
    return this.entityIdentifier;
  }

  public void setEntityIdentifier(String entityIdentifier) {
    this.entityIdentifier = entityIdentifier;
  }

  public void unsetEntityIdentifier() {
    this.entityIdentifier = null;
  }

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

  public void setEntityIdentifierIsSet(boolean value) {
    if (!value) {
      this.entityIdentifier = null;
    }
  }

  public String getDescription() {
    return this.description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  /**
   * 
   * @see EntityProcessedState
   */
  public EntityProcessedState getEntityProcessedState() {
    return this.entityProcessedState;
  }

  /**
   * 
   * @see EntityProcessedState
   */
  public void setEntityProcessedState(EntityProcessedState entityProcessedState) {
    this.entityProcessedState = entityProcessedState;
  }

  public void unsetEntityProcessedState() {
    this.entityProcessedState = null;
  }

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

  public void setEntityProcessedStateIsSet(boolean value) {
    if (!value) {
      this.entityProcessedState = null;
    }
  }

  public long getLastAlertedTime() {
    return this.lastAlertedTime;
  }

  public void setLastAlertedTime(long lastAlertedTime) {
    this.lastAlertedTime = lastAlertedTime;
    setLastAlertedTimeIsSet(true);
  }

  public void unsetLastAlertedTime() {
    __isset_bit_vector.clear(__LASTALERTEDTIME_ISSET_ID);
  }

  /** Returns true if field lastAlertedTime is set (has been assigned a value) and false otherwise */
  public boolean isSetLastAlertedTime() {
    return __isset_bit_vector.get(__LASTALERTEDTIME_ISSET_ID);
  }

  public void setLastAlertedTimeIsSet(boolean value) {
    __isset_bit_vector.set(__LASTALERTEDTIME_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case ENTITY_TYPE:
      if (value == null) {
        unsetEntityType();
      } else {
        setEntityType((EntityType)value);
      }
      break;

    case EVENT_TYPE:
      if (value == null) {
        unsetEventType();
      } else {
        setEventType((Integer)value);
      }
      break;

    case ENTITY_IDENTIFIER:
      if (value == null) {
        unsetEntityIdentifier();
      } else {
        setEntityIdentifier((String)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    case ENTITY_PROCESSED_STATE:
      if (value == null) {
        unsetEntityProcessedState();
      } else {
        setEntityProcessedState((EntityProcessedState)value);
      }
      break;

    case LAST_ALERTED_TIME:
      if (value == null) {
        unsetLastAlertedTime();
      } else {
        setLastAlertedTime((Long)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return Long.valueOf(getId());

    case ENTITY_TYPE:
      return getEntityType();

    case EVENT_TYPE:
      return Integer.valueOf(getEventType());

    case ENTITY_IDENTIFIER:
      return getEntityIdentifier();

    case DESCRIPTION:
      return getDescription();

    case ENTITY_PROCESSED_STATE:
      return getEntityProcessedState();

    case LAST_ALERTED_TIME:
      return Long.valueOf(getLastAlertedTime());

    }
    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 ID:
      return isSetId();
    case ENTITY_TYPE:
      return isSetEntityType();
    case EVENT_TYPE:
      return isSetEventType();
    case ENTITY_IDENTIFIER:
      return isSetEntityIdentifier();
    case DESCRIPTION:
      return isSetDescription();
    case ENTITY_PROCESSED_STATE:
      return isSetEntityProcessedState();
    case LAST_ALERTED_TIME:
      return isSetLastAlertedTime();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_entityType = true && this.isSetEntityType();
    boolean that_present_entityType = true && that.isSetEntityType();
    if (this_present_entityType || that_present_entityType) {
      if (!(this_present_entityType && that_present_entityType))
        return false;
      if (!this.entityType.equals(that.entityType))
        return false;
    }

    boolean this_present_eventType = true;
    boolean that_present_eventType = true;
    if (this_present_eventType || that_present_eventType) {
      if (!(this_present_eventType && that_present_eventType))
        return false;
      if (this.eventType != that.eventType)
        return false;
    }

    boolean this_present_entityIdentifier = true && this.isSetEntityIdentifier();
    boolean that_present_entityIdentifier = true && that.isSetEntityIdentifier();
    if (this_present_entityIdentifier || that_present_entityIdentifier) {
      if (!(this_present_entityIdentifier && that_present_entityIdentifier))
        return false;
      if (!this.entityIdentifier.equals(that.entityIdentifier))
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    boolean this_present_entityProcessedState = true && this.isSetEntityProcessedState();
    boolean that_present_entityProcessedState = true && that.isSetEntityProcessedState();
    if (this_present_entityProcessedState || that_present_entityProcessedState) {
      if (!(this_present_entityProcessedState && that_present_entityProcessedState))
        return false;
      if (!this.entityProcessedState.equals(that.entityProcessedState))
        return false;
    }

    boolean this_present_lastAlertedTime = true;
    boolean that_present_lastAlertedTime = true;
    if (this_present_lastAlertedTime || that_present_lastAlertedTime) {
      if (!(this_present_lastAlertedTime && that_present_lastAlertedTime))
        return false;
      if (this.lastAlertedTime != that.lastAlertedTime)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

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

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

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEntityType()).compareTo(typedOther.isSetEntityType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEntityType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entityType, typedOther.entityType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEventType()).compareTo(typedOther.isSetEventType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEventType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.eventType, typedOther.eventType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEntityIdentifier()).compareTo(typedOther.isSetEntityIdentifier());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEntityIdentifier()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entityIdentifier, typedOther.entityIdentifier);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(typedOther.isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDescription()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, typedOther.description);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEntityProcessedState()).compareTo(typedOther.isSetEntityProcessedState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEntityProcessedState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.entityProcessedState, typedOther.entityProcessedState);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastAlertedTime()).compareTo(typedOther.isSetLastAlertedTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastAlertedTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastAlertedTime, typedOther.lastAlertedTime);
      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 {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // ENTITY_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.entityType = EntityType.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // EVENT_TYPE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.eventType = iprot.readI32();
            setEventTypeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ENTITY_IDENTIFIER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.entityIdentifier = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // DESCRIPTION
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.description = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // ENTITY_PROCESSED_STATE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.entityProcessedState = EntityProcessedState.findByValue(iprot.readI32());
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // LAST_ALERTED_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.lastAlertedTime = iprot.readI64();
            setLastAlertedTimeIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    if (this.entityType != null) {
      oprot.writeFieldBegin(ENTITY_TYPE_FIELD_DESC);
      oprot.writeI32(this.entityType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(EVENT_TYPE_FIELD_DESC);
    oprot.writeI32(this.eventType);
    oprot.writeFieldEnd();
    if (this.entityIdentifier != null) {
      oprot.writeFieldBegin(ENTITY_IDENTIFIER_FIELD_DESC);
      oprot.writeString(this.entityIdentifier);
      oprot.writeFieldEnd();
    }
    if (this.description != null) {
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.description);
      oprot.writeFieldEnd();
    }
    if (this.entityProcessedState != null) {
      oprot.writeFieldBegin(ENTITY_PROCESSED_STATE_FIELD_DESC);
      oprot.writeI32(this.entityProcessedState.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(LAST_ALERTED_TIME_FIELD_DESC);
    oprot.writeI64(this.lastAlertedTime);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("entityType:");
    if (this.entityType == null) {
      sb.append("null");
    } else {
      sb.append(this.entityType);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("eventType:");
    sb.append(this.eventType);
    first = false;
    if (!first) sb.append(", ");
    sb.append("entityIdentifier:");
    if (this.entityIdentifier == null) {
      sb.append("null");
    } else {
      sb.append(this.entityIdentifier);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("entityProcessedState:");
    if (this.entityProcessedState == null) {
      sb.append("null");
    } else {
      sb.append(this.entityProcessedState);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("lastAlertedTime:");
    sb.append(this.lastAlertedTime);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  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_bit_vector = new BitSet(1);
      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);
    }
  }

}