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

tech.aroma.thrift.Message 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;

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 Message 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("Message");

  private static final org.apache.thrift.protocol.TField MESSAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("messageId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField URGENCY_FIELD_DESC = new org.apache.thrift.protocol.TField("urgency", org.apache.thrift.protocol.TType.I32, (short)3);
  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)4);
  private static final org.apache.thrift.protocol.TField TIME_MESSAGE_RECEIVED_FIELD_DESC = new org.apache.thrift.protocol.TField("timeMessageReceived", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("hostname", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField MAC_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("macAddress", org.apache.thrift.protocol.TType.STRING, (short)8);
  private static final org.apache.thrift.protocol.TField IS_TRUNCATED_FIELD_DESC = new org.apache.thrift.protocol.TField("isTruncated", org.apache.thrift.protocol.TType.BOOL, (short)9);
  private static final org.apache.thrift.protocol.TField TITLE_FIELD_DESC = new org.apache.thrift.protocol.TField("title", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField APPLICATION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationId", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField DEVICE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("deviceName", org.apache.thrift.protocol.TType.STRING, (short)12);

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

  /**
   * Each message has a unique ID
   */
  public String messageId; // required
  /**
   * The body represents the Message's Payload, i.e. the actual message.
   * If the Message Body is too long, it may be truncated. The complete
   * body can then be loaded in a separate request.
   */
  public String body; // optional
  /**
   * 
   * @see Urgency
   */
  public Urgency urgency; // required
  /**
   * The time the message was created on the Application side
   */
  public long timeOfCreation; // required
  /**
   * The time the message was received on the Server side
   */
  public long timeMessageReceived; // required
  /**
   * Name of the Application that sent the message.
   */
  public String applicationName; // required
  /**
   * The Network Hostname of the Device sending the message, ideally the FQDM.
   */
  public String hostname; // optional
  public String macAddress; // optional
  public boolean isTruncated; // optional
  public String title; // required
  /**
   * The ID of the Application the Message was sent from.
   */
  public String applicationId; // required
  public String deviceName; // 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 {
    /**
     * Each message has a unique ID
     */
    MESSAGE_ID((short)1, "messageId"),
    /**
     * The body represents the Message's Payload, i.e. the actual message.
     * If the Message Body is too long, it may be truncated. The complete
     * body can then be loaded in a separate request.
     */
    BODY((short)2, "body"),
    /**
     * 
     * @see Urgency
     */
    URGENCY((short)3, "urgency"),
    /**
     * The time the message was created on the Application side
     */
    TIME_OF_CREATION((short)4, "timeOfCreation"),
    /**
     * The time the message was received on the Server side
     */
    TIME_MESSAGE_RECEIVED((short)5, "timeMessageReceived"),
    /**
     * Name of the Application that sent the message.
     */
    APPLICATION_NAME((short)6, "applicationName"),
    /**
     * The Network Hostname of the Device sending the message, ideally the FQDM.
     */
    HOSTNAME((short)7, "hostname"),
    MAC_ADDRESS((short)8, "macAddress"),
    IS_TRUNCATED((short)9, "isTruncated"),
    TITLE((short)10, "title"),
    /**
     * The ID of the Application the Message was sent from.
     */
    APPLICATION_ID((short)11, "applicationId"),
    DEVICE_NAME((short)12, "deviceName");

    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: // MESSAGE_ID
          return MESSAGE_ID;
        case 2: // BODY
          return BODY;
        case 3: // URGENCY
          return URGENCY;
        case 4: // TIME_OF_CREATION
          return TIME_OF_CREATION;
        case 5: // TIME_MESSAGE_RECEIVED
          return TIME_MESSAGE_RECEIVED;
        case 6: // APPLICATION_NAME
          return APPLICATION_NAME;
        case 7: // HOSTNAME
          return HOSTNAME;
        case 8: // MAC_ADDRESS
          return MAC_ADDRESS;
        case 9: // IS_TRUNCATED
          return IS_TRUNCATED;
        case 10: // TITLE
          return TITLE;
        case 11: // APPLICATION_ID
          return APPLICATION_ID;
        case 12: // DEVICE_NAME
          return DEVICE_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 __TIMEMESSAGERECEIVED_ISSET_ID = 1;
  private static final int __ISTRUNCATED_ISSET_ID = 2;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.BODY,_Fields.HOSTNAME,_Fields.MAC_ADDRESS,_Fields.IS_TRUNCATED,_Fields.DEVICE_NAME};
  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.MESSAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("messageId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "uuid")));
    tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.URGENCY, new org.apache.thrift.meta_data.FieldMetaData("urgency", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Urgency.class)));
    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_MESSAGE_RECEIVED, new org.apache.thrift.meta_data.FieldMetaData("timeMessageReceived", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "timestamp")));
    tmpMap.put(_Fields.APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("applicationName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HOSTNAME, new org.apache.thrift.meta_data.FieldMetaData("hostname", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MAC_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("macAddress", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IS_TRUNCATED, new org.apache.thrift.meta_data.FieldMetaData("isTruncated", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.TITLE, new org.apache.thrift.meta_data.FieldMetaData("title", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.APPLICATION_ID, new org.apache.thrift.meta_data.FieldMetaData("applicationId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , "uuid")));
    tmpMap.put(_Fields.DEVICE_NAME, new org.apache.thrift.meta_data.FieldMetaData("deviceName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Message.class, metaDataMap);
  }

  public Message() {
    this.urgency = tech.aroma.thrift.Urgency.LOW;

    this.isTruncated = false;

  }

  public Message(
    String messageId,
    Urgency urgency,
    long timeOfCreation,
    long timeMessageReceived,
    String applicationName,
    String title,
    String applicationId)
  {
    this();
    this.messageId = messageId;
    this.urgency = urgency;
    this.timeOfCreation = timeOfCreation;
    setTimeOfCreationIsSet(true);
    this.timeMessageReceived = timeMessageReceived;
    setTimeMessageReceivedIsSet(true);
    this.applicationName = applicationName;
    this.title = title;
    this.applicationId = applicationId;
  }

  /**
   * Performs a deep copy on other.
   */
  public Message(Message other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetMessageId()) {
      this.messageId = other.messageId;
    }
    if (other.isSetBody()) {
      this.body = other.body;
    }
    if (other.isSetUrgency()) {
      this.urgency = other.urgency;
    }
    this.timeOfCreation = other.timeOfCreation;
    this.timeMessageReceived = other.timeMessageReceived;
    if (other.isSetApplicationName()) {
      this.applicationName = other.applicationName;
    }
    if (other.isSetHostname()) {
      this.hostname = other.hostname;
    }
    if (other.isSetMacAddress()) {
      this.macAddress = other.macAddress;
    }
    this.isTruncated = other.isTruncated;
    if (other.isSetTitle()) {
      this.title = other.title;
    }
    if (other.isSetApplicationId()) {
      this.applicationId = other.applicationId;
    }
    if (other.isSetDeviceName()) {
      this.deviceName = other.deviceName;
    }
  }

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

  @Override
  public void clear() {
    this.messageId = null;
    this.body = null;
    this.urgency = tech.aroma.thrift.Urgency.LOW;

    setTimeOfCreationIsSet(false);
    this.timeOfCreation = 0;
    setTimeMessageReceivedIsSet(false);
    this.timeMessageReceived = 0;
    this.applicationName = null;
    this.hostname = null;
    this.macAddress = null;
    this.isTruncated = false;

    this.title = null;
    this.applicationId = null;
    this.deviceName = null;
  }

  /**
   * Each message has a unique ID
   */
  public String getMessageId() {
    return this.messageId;
  }

  /**
   * Each message has a unique ID
   */
  public Message setMessageId(String messageId) {
    this.messageId = messageId;
    return this;
  }

  public void unsetMessageId() {
    this.messageId = null;
  }

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

  public void setMessageIdIsSet(boolean value) {
    if (!value) {
      this.messageId = null;
    }
  }

  /**
   * The body represents the Message's Payload, i.e. the actual message.
   * If the Message Body is too long, it may be truncated. The complete
   * body can then be loaded in a separate request.
   */
  public String getBody() {
    return this.body;
  }

  /**
   * The body represents the Message's Payload, i.e. the actual message.
   * If the Message Body is too long, it may be truncated. The complete
   * body can then be loaded in a separate request.
   */
  public Message setBody(String body) {
    this.body = body;
    return this;
  }

  public void unsetBody() {
    this.body = null;
  }

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

  public void setBodyIsSet(boolean value) {
    if (!value) {
      this.body = null;
    }
  }

  /**
   * 
   * @see Urgency
   */
  public Urgency getUrgency() {
    return this.urgency;
  }

  /**
   * 
   * @see Urgency
   */
  public Message setUrgency(Urgency urgency) {
    this.urgency = urgency;
    return this;
  }

  public void unsetUrgency() {
    this.urgency = null;
  }

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

  public void setUrgencyIsSet(boolean value) {
    if (!value) {
      this.urgency = null;
    }
  }

  /**
   * The time the message was created on the Application side
   */
  public long getTimeOfCreation() {
    return this.timeOfCreation;
  }

  /**
   * The time the message was created on the Application side
   */
  public Message 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);
  }

  /**
   * The time the message was received on the Server side
   */
  public long getTimeMessageReceived() {
    return this.timeMessageReceived;
  }

  /**
   * The time the message was received on the Server side
   */
  public Message setTimeMessageReceived(long timeMessageReceived) {
    this.timeMessageReceived = timeMessageReceived;
    setTimeMessageReceivedIsSet(true);
    return this;
  }

  public void unsetTimeMessageReceived() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMEMESSAGERECEIVED_ISSET_ID);
  }

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

  public void setTimeMessageReceivedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMEMESSAGERECEIVED_ISSET_ID, value);
  }

  /**
   * Name of the Application that sent the message.
   */
  public String getApplicationName() {
    return this.applicationName;
  }

  /**
   * Name of the Application that sent the message.
   */
  public Message setApplicationName(String applicationName) {
    this.applicationName = applicationName;
    return this;
  }

  public void unsetApplicationName() {
    this.applicationName = null;
  }

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

  public void setApplicationNameIsSet(boolean value) {
    if (!value) {
      this.applicationName = null;
    }
  }

  /**
   * The Network Hostname of the Device sending the message, ideally the FQDM.
   */
  public String getHostname() {
    return this.hostname;
  }

  /**
   * The Network Hostname of the Device sending the message, ideally the FQDM.
   */
  public Message setHostname(String hostname) {
    this.hostname = hostname;
    return this;
  }

  public void unsetHostname() {
    this.hostname = null;
  }

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

  public void setHostnameIsSet(boolean value) {
    if (!value) {
      this.hostname = null;
    }
  }

  public String getMacAddress() {
    return this.macAddress;
  }

  public Message setMacAddress(String macAddress) {
    this.macAddress = macAddress;
    return this;
  }

  public void unsetMacAddress() {
    this.macAddress = null;
  }

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

  public void setMacAddressIsSet(boolean value) {
    if (!value) {
      this.macAddress = null;
    }
  }

  public boolean isIsTruncated() {
    return this.isTruncated;
  }

  public Message setIsTruncated(boolean isTruncated) {
    this.isTruncated = isTruncated;
    setIsTruncatedIsSet(true);
    return this;
  }

  public void unsetIsTruncated() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISTRUNCATED_ISSET_ID);
  }

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

  public void setIsTruncatedIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISTRUNCATED_ISSET_ID, value);
  }

  public String getTitle() {
    return this.title;
  }

  public Message setTitle(String title) {
    this.title = title;
    return this;
  }

  public void unsetTitle() {
    this.title = null;
  }

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

  public void setTitleIsSet(boolean value) {
    if (!value) {
      this.title = null;
    }
  }

  /**
   * The ID of the Application the Message was sent from.
   */
  public String getApplicationId() {
    return this.applicationId;
  }

  /**
   * The ID of the Application the Message was sent from.
   */
  public Message setApplicationId(String applicationId) {
    this.applicationId = applicationId;
    return this;
  }

  public void unsetApplicationId() {
    this.applicationId = null;
  }

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

  public void setApplicationIdIsSet(boolean value) {
    if (!value) {
      this.applicationId = null;
    }
  }

  public String getDeviceName() {
    return this.deviceName;
  }

  public Message setDeviceName(String deviceName) {
    this.deviceName = deviceName;
    return this;
  }

  public void unsetDeviceName() {
    this.deviceName = null;
  }

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

  public void setDeviceNameIsSet(boolean value) {
    if (!value) {
      this.deviceName = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case MESSAGE_ID:
      if (value == null) {
        unsetMessageId();
      } else {
        setMessageId((String)value);
      }
      break;

    case BODY:
      if (value == null) {
        unsetBody();
      } else {
        setBody((String)value);
      }
      break;

    case URGENCY:
      if (value == null) {
        unsetUrgency();
      } else {
        setUrgency((Urgency)value);
      }
      break;

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

    case TIME_MESSAGE_RECEIVED:
      if (value == null) {
        unsetTimeMessageReceived();
      } else {
        setTimeMessageReceived((Long)value);
      }
      break;

    case APPLICATION_NAME:
      if (value == null) {
        unsetApplicationName();
      } else {
        setApplicationName((String)value);
      }
      break;

    case HOSTNAME:
      if (value == null) {
        unsetHostname();
      } else {
        setHostname((String)value);
      }
      break;

    case MAC_ADDRESS:
      if (value == null) {
        unsetMacAddress();
      } else {
        setMacAddress((String)value);
      }
      break;

    case IS_TRUNCATED:
      if (value == null) {
        unsetIsTruncated();
      } else {
        setIsTruncated((Boolean)value);
      }
      break;

    case TITLE:
      if (value == null) {
        unsetTitle();
      } else {
        setTitle((String)value);
      }
      break;

    case APPLICATION_ID:
      if (value == null) {
        unsetApplicationId();
      } else {
        setApplicationId((String)value);
      }
      break;

    case DEVICE_NAME:
      if (value == null) {
        unsetDeviceName();
      } else {
        setDeviceName((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case MESSAGE_ID:
      return getMessageId();

    case BODY:
      return getBody();

    case URGENCY:
      return getUrgency();

    case TIME_OF_CREATION:
      return getTimeOfCreation();

    case TIME_MESSAGE_RECEIVED:
      return getTimeMessageReceived();

    case APPLICATION_NAME:
      return getApplicationName();

    case HOSTNAME:
      return getHostname();

    case MAC_ADDRESS:
      return getMacAddress();

    case IS_TRUNCATED:
      return isIsTruncated();

    case TITLE:
      return getTitle();

    case APPLICATION_ID:
      return getApplicationId();

    case DEVICE_NAME:
      return getDeviceName();

    }
    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 MESSAGE_ID:
      return isSetMessageId();
    case BODY:
      return isSetBody();
    case URGENCY:
      return isSetUrgency();
    case TIME_OF_CREATION:
      return isSetTimeOfCreation();
    case TIME_MESSAGE_RECEIVED:
      return isSetTimeMessageReceived();
    case APPLICATION_NAME:
      return isSetApplicationName();
    case HOSTNAME:
      return isSetHostname();
    case MAC_ADDRESS:
      return isSetMacAddress();
    case IS_TRUNCATED:
      return isSetIsTruncated();
    case TITLE:
      return isSetTitle();
    case APPLICATION_ID:
      return isSetApplicationId();
    case DEVICE_NAME:
      return isSetDeviceName();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_messageId = true && this.isSetMessageId();
    boolean that_present_messageId = true && that.isSetMessageId();
    if (this_present_messageId || that_present_messageId) {
      if (!(this_present_messageId && that_present_messageId))
        return false;
      if (!this.messageId.equals(that.messageId))
        return false;
    }

    boolean this_present_body = true && this.isSetBody();
    boolean that_present_body = true && that.isSetBody();
    if (this_present_body || that_present_body) {
      if (!(this_present_body && that_present_body))
        return false;
      if (!this.body.equals(that.body))
        return false;
    }

    boolean this_present_urgency = true && this.isSetUrgency();
    boolean that_present_urgency = true && that.isSetUrgency();
    if (this_present_urgency || that_present_urgency) {
      if (!(this_present_urgency && that_present_urgency))
        return false;
      if (!this.urgency.equals(that.urgency))
        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_timeMessageReceived = true;
    boolean that_present_timeMessageReceived = true;
    if (this_present_timeMessageReceived || that_present_timeMessageReceived) {
      if (!(this_present_timeMessageReceived && that_present_timeMessageReceived))
        return false;
      if (this.timeMessageReceived != that.timeMessageReceived)
        return false;
    }

    boolean this_present_applicationName = true && this.isSetApplicationName();
    boolean that_present_applicationName = true && that.isSetApplicationName();
    if (this_present_applicationName || that_present_applicationName) {
      if (!(this_present_applicationName && that_present_applicationName))
        return false;
      if (!this.applicationName.equals(that.applicationName))
        return false;
    }

    boolean this_present_hostname = true && this.isSetHostname();
    boolean that_present_hostname = true && that.isSetHostname();
    if (this_present_hostname || that_present_hostname) {
      if (!(this_present_hostname && that_present_hostname))
        return false;
      if (!this.hostname.equals(that.hostname))
        return false;
    }

    boolean this_present_macAddress = true && this.isSetMacAddress();
    boolean that_present_macAddress = true && that.isSetMacAddress();
    if (this_present_macAddress || that_present_macAddress) {
      if (!(this_present_macAddress && that_present_macAddress))
        return false;
      if (!this.macAddress.equals(that.macAddress))
        return false;
    }

    boolean this_present_isTruncated = true && this.isSetIsTruncated();
    boolean that_present_isTruncated = true && that.isSetIsTruncated();
    if (this_present_isTruncated || that_present_isTruncated) {
      if (!(this_present_isTruncated && that_present_isTruncated))
        return false;
      if (this.isTruncated != that.isTruncated)
        return false;
    }

    boolean this_present_title = true && this.isSetTitle();
    boolean that_present_title = true && that.isSetTitle();
    if (this_present_title || that_present_title) {
      if (!(this_present_title && that_present_title))
        return false;
      if (!this.title.equals(that.title))
        return false;
    }

    boolean this_present_applicationId = true && this.isSetApplicationId();
    boolean that_present_applicationId = true && that.isSetApplicationId();
    if (this_present_applicationId || that_present_applicationId) {
      if (!(this_present_applicationId && that_present_applicationId))
        return false;
      if (!this.applicationId.equals(that.applicationId))
        return false;
    }

    boolean this_present_deviceName = true && this.isSetDeviceName();
    boolean that_present_deviceName = true && that.isSetDeviceName();
    if (this_present_deviceName || that_present_deviceName) {
      if (!(this_present_deviceName && that_present_deviceName))
        return false;
      if (!this.deviceName.equals(that.deviceName))
        return false;
    }

    return true;
  }

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

    boolean present_messageId = true && (isSetMessageId());
    list.add(present_messageId);
    if (present_messageId)
      list.add(messageId);

    boolean present_body = true && (isSetBody());
    list.add(present_body);
    if (present_body)
      list.add(body);

    boolean present_urgency = true && (isSetUrgency());
    list.add(present_urgency);
    if (present_urgency)
      list.add(urgency.getValue());

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

    boolean present_timeMessageReceived = true;
    list.add(present_timeMessageReceived);
    if (present_timeMessageReceived)
      list.add(timeMessageReceived);

    boolean present_applicationName = true && (isSetApplicationName());
    list.add(present_applicationName);
    if (present_applicationName)
      list.add(applicationName);

    boolean present_hostname = true && (isSetHostname());
    list.add(present_hostname);
    if (present_hostname)
      list.add(hostname);

    boolean present_macAddress = true && (isSetMacAddress());
    list.add(present_macAddress);
    if (present_macAddress)
      list.add(macAddress);

    boolean present_isTruncated = true && (isSetIsTruncated());
    list.add(present_isTruncated);
    if (present_isTruncated)
      list.add(isTruncated);

    boolean present_title = true && (isSetTitle());
    list.add(present_title);
    if (present_title)
      list.add(title);

    boolean present_applicationId = true && (isSetApplicationId());
    list.add(present_applicationId);
    if (present_applicationId)
      list.add(applicationId);

    boolean present_deviceName = true && (isSetDeviceName());
    list.add(present_deviceName);
    if (present_deviceName)
      list.add(deviceName);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetMessageId()).compareTo(other.isSetMessageId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMessageId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.messageId, other.messageId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBody()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUrgency()).compareTo(other.isSetUrgency());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUrgency()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.urgency, other.urgency);
      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(isSetTimeMessageReceived()).compareTo(other.isSetTimeMessageReceived());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeMessageReceived()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeMessageReceived, other.timeMessageReceived);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetApplicationName()).compareTo(other.isSetApplicationName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApplicationName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationName, other.applicationName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHostname()).compareTo(other.isSetHostname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHostname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostname, other.hostname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMacAddress()).compareTo(other.isSetMacAddress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMacAddress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.macAddress, other.macAddress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIsTruncated()).compareTo(other.isSetIsTruncated());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsTruncated()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isTruncated, other.isTruncated);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTitle()).compareTo(other.isSetTitle());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTitle()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.title, other.title);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetApplicationId()).compareTo(other.isSetApplicationId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApplicationId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationId, other.applicationId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDeviceName()).compareTo(other.isSetDeviceName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDeviceName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deviceName, other.deviceName);
      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("Message(");
    boolean first = true;

    sb.append("messageId:");
    if (this.messageId == null) {
      sb.append("null");
    } else {
      sb.append(this.messageId);
    }
    first = false;
    if (isSetBody()) {
      if (!first) sb.append(", ");
      sb.append("body:");
      if (this.body == null) {
        sb.append("null");
      } else {
        sb.append(this.body);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("urgency:");
    if (this.urgency == null) {
      sb.append("null");
    } else {
      sb.append(this.urgency);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeOfCreation:");
    sb.append(this.timeOfCreation);
    first = false;
    if (!first) sb.append(", ");
    sb.append("timeMessageReceived:");
    sb.append(this.timeMessageReceived);
    first = false;
    if (!first) sb.append(", ");
    sb.append("applicationName:");
    if (this.applicationName == null) {
      sb.append("null");
    } else {
      sb.append(this.applicationName);
    }
    first = false;
    if (isSetHostname()) {
      if (!first) sb.append(", ");
      sb.append("hostname:");
      if (this.hostname == null) {
        sb.append("null");
      } else {
        sb.append(this.hostname);
      }
      first = false;
    }
    if (isSetMacAddress()) {
      if (!first) sb.append(", ");
      sb.append("macAddress:");
      if (this.macAddress == null) {
        sb.append("null");
      } else {
        sb.append(this.macAddress);
      }
      first = false;
    }
    if (isSetIsTruncated()) {
      if (!first) sb.append(", ");
      sb.append("isTruncated:");
      sb.append(this.isTruncated);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("title:");
    if (this.title == null) {
      sb.append("null");
    } else {
      sb.append(this.title);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("applicationId:");
    if (this.applicationId == null) {
      sb.append("null");
    } else {
      sb.append(this.applicationId);
    }
    first = false;
    if (isSetDeviceName()) {
      if (!first) sb.append(", ");
      sb.append("deviceName:");
      if (this.deviceName == null) {
        sb.append("null");
      } else {
        sb.append(this.deviceName);
      }
      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 MessageStandardSchemeFactory implements SchemeFactory {
    public MessageStandardScheme getScheme() {
      return new MessageStandardScheme();
    }
  }

  private static class MessageStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Message 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: // MESSAGE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.messageId = iprot.readString();
              struct.setMessageIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BODY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.body = iprot.readString();
              struct.setBodyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // URGENCY
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.urgency = tech.aroma.thrift.Urgency.findByValue(iprot.readI32());
              struct.setUrgencyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // 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 5: // TIME_MESSAGE_RECEIVED
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeMessageReceived = iprot.readI64();
              struct.setTimeMessageReceivedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // APPLICATION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.applicationName = iprot.readString();
              struct.setApplicationNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // HOSTNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.hostname = iprot.readString();
              struct.setHostnameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // MAC_ADDRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.macAddress = iprot.readString();
              struct.setMacAddressIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // IS_TRUNCATED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.isTruncated = iprot.readBool();
              struct.setIsTruncatedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // TITLE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.title = iprot.readString();
              struct.setTitleIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // APPLICATION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.applicationId = iprot.readString();
              struct.setApplicationIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // DEVICE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.deviceName = iprot.readString();
              struct.setDeviceNameIsSet(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, Message struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.messageId != null) {
        oprot.writeFieldBegin(MESSAGE_ID_FIELD_DESC);
        oprot.writeString(struct.messageId);
        oprot.writeFieldEnd();
      }
      if (struct.body != null) {
        if (struct.isSetBody()) {
          oprot.writeFieldBegin(BODY_FIELD_DESC);
          oprot.writeString(struct.body);
          oprot.writeFieldEnd();
        }
      }
      if (struct.urgency != null) {
        oprot.writeFieldBegin(URGENCY_FIELD_DESC);
        oprot.writeI32(struct.urgency.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIME_OF_CREATION_FIELD_DESC);
      oprot.writeI64(struct.timeOfCreation);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TIME_MESSAGE_RECEIVED_FIELD_DESC);
      oprot.writeI64(struct.timeMessageReceived);
      oprot.writeFieldEnd();
      if (struct.applicationName != null) {
        oprot.writeFieldBegin(APPLICATION_NAME_FIELD_DESC);
        oprot.writeString(struct.applicationName);
        oprot.writeFieldEnd();
      }
      if (struct.hostname != null) {
        if (struct.isSetHostname()) {
          oprot.writeFieldBegin(HOSTNAME_FIELD_DESC);
          oprot.writeString(struct.hostname);
          oprot.writeFieldEnd();
        }
      }
      if (struct.macAddress != null) {
        if (struct.isSetMacAddress()) {
          oprot.writeFieldBegin(MAC_ADDRESS_FIELD_DESC);
          oprot.writeString(struct.macAddress);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIsTruncated()) {
        oprot.writeFieldBegin(IS_TRUNCATED_FIELD_DESC);
        oprot.writeBool(struct.isTruncated);
        oprot.writeFieldEnd();
      }
      if (struct.title != null) {
        oprot.writeFieldBegin(TITLE_FIELD_DESC);
        oprot.writeString(struct.title);
        oprot.writeFieldEnd();
      }
      if (struct.applicationId != null) {
        oprot.writeFieldBegin(APPLICATION_ID_FIELD_DESC);
        oprot.writeString(struct.applicationId);
        oprot.writeFieldEnd();
      }
      if (struct.deviceName != null) {
        if (struct.isSetDeviceName()) {
          oprot.writeFieldBegin(DEVICE_NAME_FIELD_DESC);
          oprot.writeString(struct.deviceName);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class MessageTupleSchemeFactory implements SchemeFactory {
    public MessageTupleScheme getScheme() {
      return new MessageTupleScheme();
    }
  }

  private static class MessageTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetMessageId()) {
        optionals.set(0);
      }
      if (struct.isSetBody()) {
        optionals.set(1);
      }
      if (struct.isSetUrgency()) {
        optionals.set(2);
      }
      if (struct.isSetTimeOfCreation()) {
        optionals.set(3);
      }
      if (struct.isSetTimeMessageReceived()) {
        optionals.set(4);
      }
      if (struct.isSetApplicationName()) {
        optionals.set(5);
      }
      if (struct.isSetHostname()) {
        optionals.set(6);
      }
      if (struct.isSetMacAddress()) {
        optionals.set(7);
      }
      if (struct.isSetIsTruncated()) {
        optionals.set(8);
      }
      if (struct.isSetTitle()) {
        optionals.set(9);
      }
      if (struct.isSetApplicationId()) {
        optionals.set(10);
      }
      if (struct.isSetDeviceName()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetMessageId()) {
        oprot.writeString(struct.messageId);
      }
      if (struct.isSetBody()) {
        oprot.writeString(struct.body);
      }
      if (struct.isSetUrgency()) {
        oprot.writeI32(struct.urgency.getValue());
      }
      if (struct.isSetTimeOfCreation()) {
        oprot.writeI64(struct.timeOfCreation);
      }
      if (struct.isSetTimeMessageReceived()) {
        oprot.writeI64(struct.timeMessageReceived);
      }
      if (struct.isSetApplicationName()) {
        oprot.writeString(struct.applicationName);
      }
      if (struct.isSetHostname()) {
        oprot.writeString(struct.hostname);
      }
      if (struct.isSetMacAddress()) {
        oprot.writeString(struct.macAddress);
      }
      if (struct.isSetIsTruncated()) {
        oprot.writeBool(struct.isTruncated);
      }
      if (struct.isSetTitle()) {
        oprot.writeString(struct.title);
      }
      if (struct.isSetApplicationId()) {
        oprot.writeString(struct.applicationId);
      }
      if (struct.isSetDeviceName()) {
        oprot.writeString(struct.deviceName);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Message struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.messageId = iprot.readString();
        struct.setMessageIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.body = iprot.readString();
        struct.setBodyIsSet(true);
      }
      if (incoming.get(2)) {
        struct.urgency = tech.aroma.thrift.Urgency.findByValue(iprot.readI32());
        struct.setUrgencyIsSet(true);
      }
      if (incoming.get(3)) {
        struct.timeOfCreation = iprot.readI64();
        struct.setTimeOfCreationIsSet(true);
      }
      if (incoming.get(4)) {
        struct.timeMessageReceived = iprot.readI64();
        struct.setTimeMessageReceivedIsSet(true);
      }
      if (incoming.get(5)) {
        struct.applicationName = iprot.readString();
        struct.setApplicationNameIsSet(true);
      }
      if (incoming.get(6)) {
        struct.hostname = iprot.readString();
        struct.setHostnameIsSet(true);
      }
      if (incoming.get(7)) {
        struct.macAddress = iprot.readString();
        struct.setMacAddressIsSet(true);
      }
      if (incoming.get(8)) {
        struct.isTruncated = iprot.readBool();
        struct.setIsTruncatedIsSet(true);
      }
      if (incoming.get(9)) {
        struct.title = iprot.readString();
        struct.setTitleIsSet(true);
      }
      if (incoming.get(10)) {
        struct.applicationId = iprot.readString();
        struct.setApplicationIdIsSet(true);
      }
      if (incoming.get(11)) {
        struct.deviceName = iprot.readString();
        struct.setDeviceNameIsSet(true);
      }
    }
  }

}