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

org.apache.airavata.model.user.UserProfile Maven / Gradle / Ivy

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.airavata.model.user;

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"})
/**
 * * A structure holding the user profile and its child models.
 * *
 * * Notes:
 * *  The model does not include passwords as it is assumed an external identity provider is used to authenticate user.
 * *  References:
 * *     NSF Demographic Information - http://www.nsf.gov/pubs/2000/00form1225/00form1225.doc
 * *     LDAP Schema - https://tools.ietf.org/html/rfc4519
 * *     SCIM 2.0 - https://tools.ietf.org/html/rfc7643
 * *
 * * userModelVersion:
 * *  Version number of profile
 * *
 * * airavataInternalUserId:
 * *  internal to Airavata, not intended to be used outside of the Airavata platform or possibly by gateways
 * *  (that is, never shown to users), never reassigned, REQUIRED
 * *
 * * userId:
 * *  Externally assertable unique identifier. SAML (primarly in higher education, academic) tends to keep
 * *   user name less opaque. OpenID Connect maintains them to be opaque.
 * *
 * * emails:
 * *   Email identifier are Verified, REQUIRED and MULTIVALUED
 * *
 * * userName:
 * *  Name-based identifiers can be multivalues. To keep it simple, Airavata will make it a string.
 * *   In the future these can be enumerated as:
 *     *   Official name (as asserted possibly by some external identity provider)
 *     *   Prefered name (as asserted or suggested by user directly)
 *     *   Components:
 *     *      givenName
 *     *      surname (familyName)
 *     *      displayName (often asserted by user to handle things like middle names, suffix, prefix, and the like)
 * *
 * * orcidId: ORCID ID - http://orcid.org/about/what-is-orcid)
 * *
 * * phones: Telephone MULTIVALUED
 * *
 * * country: Country of Residance
 * *
 * * nationality Countries of citizenship
 * *
 * * comments:
 * *   Free-form information (treated as opaque by Airavata and simply passed to resource).
 * *
 * * labeledURI:
 *   * Google Scholar, Web of Science, ACS, e.t.c
 * *
 * * timeZone:
 * *  User’s preferred timezone - IANA Timezone Databases - http://www.iana.org/time-zones.
 * *
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-07-13")
public class UserProfile 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("UserProfile");

  private static final org.apache.thrift.protocol.TField USER_MODEL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("userModelVersion", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField AIRAVATA_INTERNAL_USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("airavataInternalUserId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField EMAILS_FIELD_DESC = new org.apache.thrift.protocol.TField("emails", org.apache.thrift.protocol.TType.LIST, (short)4);
  private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField ORCID_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("orcidId", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField PHONES_FIELD_DESC = new org.apache.thrift.protocol.TField("phones", org.apache.thrift.protocol.TType.LIST, (short)7);
  private static final org.apache.thrift.protocol.TField COUNTRY_FIELD_DESC = new org.apache.thrift.protocol.TField("country", org.apache.thrift.protocol.TType.STRING, (short)8);
  private static final org.apache.thrift.protocol.TField NATIONALITY_FIELD_DESC = new org.apache.thrift.protocol.TField("nationality", org.apache.thrift.protocol.TType.LIST, (short)9);
  private static final org.apache.thrift.protocol.TField HOME_ORGANIZATION_FIELD_DESC = new org.apache.thrift.protocol.TField("homeOrganization", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField ORGINATION_AFFILIATION_FIELD_DESC = new org.apache.thrift.protocol.TField("orginationAffiliation", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField CREATION_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("creationTime", org.apache.thrift.protocol.TType.STRING, (short)12);
  private static final org.apache.thrift.protocol.TField LAST_ACCESS_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastAccessTime", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField VALID_UNTIL_FIELD_DESC = new org.apache.thrift.protocol.TField("validUntil", org.apache.thrift.protocol.TType.STRING, (short)14);
  private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("State", org.apache.thrift.protocol.TType.I32, (short)15);
  private static final org.apache.thrift.protocol.TField COMMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("comments", org.apache.thrift.protocol.TType.STRING, (short)16);
  private static final org.apache.thrift.protocol.TField LABELED_URI_FIELD_DESC = new org.apache.thrift.protocol.TField("labeledURI", org.apache.thrift.protocol.TType.LIST, (short)17);
  private static final org.apache.thrift.protocol.TField GPG_KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("gpgKey", org.apache.thrift.protocol.TType.STRING, (short)18);
  private static final org.apache.thrift.protocol.TField TIME_ZONE_FIELD_DESC = new org.apache.thrift.protocol.TField("timeZone", org.apache.thrift.protocol.TType.STRING, (short)19);
  private static final org.apache.thrift.protocol.TField NSF_DEMOGRAPHICS_FIELD_DESC = new org.apache.thrift.protocol.TField("nsfDemographics", org.apache.thrift.protocol.TType.STRUCT, (short)20);

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

  private String userModelVersion; // required
  private String airavataInternalUserId; // required
  private String userId; // required
  private List emails; // required
  private String userName; // optional
  private String orcidId; // optional
  private List phones; // optional
  private String country; // optional
  private List nationality; // optional
  private String homeOrganization; // optional
  private String orginationAffiliation; // optional
  private String creationTime; // required
  private String lastAccessTime; // required
  private String validUntil; // required
  private Status State; // required
  private String comments; // optional
  private List labeledURI; // optional
  private String gpgKey; // optional
  private String timeZone; // optional
  private NSFDemographics nsfDemographics; // 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 {
    USER_MODEL_VERSION((short)1, "userModelVersion"),
    AIRAVATA_INTERNAL_USER_ID((short)2, "airavataInternalUserId"),
    USER_ID((short)3, "userId"),
    EMAILS((short)4, "emails"),
    USER_NAME((short)5, "userName"),
    ORCID_ID((short)6, "orcidId"),
    PHONES((short)7, "phones"),
    COUNTRY((short)8, "country"),
    NATIONALITY((short)9, "nationality"),
    HOME_ORGANIZATION((short)10, "homeOrganization"),
    ORGINATION_AFFILIATION((short)11, "orginationAffiliation"),
    CREATION_TIME((short)12, "creationTime"),
    LAST_ACCESS_TIME((short)13, "lastAccessTime"),
    VALID_UNTIL((short)14, "validUntil"),
    /**
     * 
     * @see Status
     */
    STATE((short)15, "State"),
    COMMENTS((short)16, "comments"),
    LABELED_URI((short)17, "labeledURI"),
    GPG_KEY((short)18, "gpgKey"),
    TIME_ZONE((short)19, "timeZone"),
    NSF_DEMOGRAPHICS((short)20, "nsfDemographics");

    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: // USER_MODEL_VERSION
          return USER_MODEL_VERSION;
        case 2: // AIRAVATA_INTERNAL_USER_ID
          return AIRAVATA_INTERNAL_USER_ID;
        case 3: // USER_ID
          return USER_ID;
        case 4: // EMAILS
          return EMAILS;
        case 5: // USER_NAME
          return USER_NAME;
        case 6: // ORCID_ID
          return ORCID_ID;
        case 7: // PHONES
          return PHONES;
        case 8: // COUNTRY
          return COUNTRY;
        case 9: // NATIONALITY
          return NATIONALITY;
        case 10: // HOME_ORGANIZATION
          return HOME_ORGANIZATION;
        case 11: // ORGINATION_AFFILIATION
          return ORGINATION_AFFILIATION;
        case 12: // CREATION_TIME
          return CREATION_TIME;
        case 13: // LAST_ACCESS_TIME
          return LAST_ACCESS_TIME;
        case 14: // VALID_UNTIL
          return VALID_UNTIL;
        case 15: // STATE
          return STATE;
        case 16: // COMMENTS
          return COMMENTS;
        case 17: // LABELED_URI
          return LABELED_URI;
        case 18: // GPG_KEY
          return GPG_KEY;
        case 19: // TIME_ZONE
          return TIME_ZONE;
        case 20: // NSF_DEMOGRAPHICS
          return NSF_DEMOGRAPHICS;
        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 _Fields optionals[] = {_Fields.USER_NAME,_Fields.ORCID_ID,_Fields.PHONES,_Fields.COUNTRY,_Fields.NATIONALITY,_Fields.HOME_ORGANIZATION,_Fields.ORGINATION_AFFILIATION,_Fields.COMMENTS,_Fields.LABELED_URI,_Fields.GPG_KEY,_Fields.TIME_ZONE,_Fields.NSF_DEMOGRAPHICS};
  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.USER_MODEL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("userModelVersion", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.AIRAVATA_INTERNAL_USER_ID, new org.apache.thrift.meta_data.FieldMetaData("airavataInternalUserId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.EMAILS, new org.apache.thrift.meta_data.FieldMetaData("emails", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ORCID_ID, new org.apache.thrift.meta_data.FieldMetaData("orcidId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PHONES, new org.apache.thrift.meta_data.FieldMetaData("phones", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.COUNTRY, new org.apache.thrift.meta_data.FieldMetaData("country", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NATIONALITY, new org.apache.thrift.meta_data.FieldMetaData("nationality", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.HOME_ORGANIZATION, new org.apache.thrift.meta_data.FieldMetaData("homeOrganization", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ORGINATION_AFFILIATION, new org.apache.thrift.meta_data.FieldMetaData("orginationAffiliation", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CREATION_TIME, new org.apache.thrift.meta_data.FieldMetaData("creationTime", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.LAST_ACCESS_TIME, new org.apache.thrift.meta_data.FieldMetaData("lastAccessTime", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VALID_UNTIL, new org.apache.thrift.meta_data.FieldMetaData("validUntil", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("State", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
    tmpMap.put(_Fields.COMMENTS, new org.apache.thrift.meta_data.FieldMetaData("comments", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.LABELED_URI, new org.apache.thrift.meta_data.FieldMetaData("labeledURI", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    tmpMap.put(_Fields.GPG_KEY, new org.apache.thrift.meta_data.FieldMetaData("gpgKey", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TIME_ZONE, new org.apache.thrift.meta_data.FieldMetaData("timeZone", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.NSF_DEMOGRAPHICS, new org.apache.thrift.meta_data.FieldMetaData("nsfDemographics", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, NSFDemographics.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserProfile.class, metaDataMap);
  }

  public UserProfile() {
    this.userModelVersion = "1.0";

    this.airavataInternalUserId = "DO_NOT_SET_AT_CLIENTS";

  }

  public UserProfile(
    String userModelVersion,
    String airavataInternalUserId,
    String userId,
    List emails,
    String creationTime,
    String lastAccessTime,
    String validUntil,
    Status State)
  {
    this();
    this.userModelVersion = userModelVersion;
    this.airavataInternalUserId = airavataInternalUserId;
    this.userId = userId;
    this.emails = emails;
    this.creationTime = creationTime;
    this.lastAccessTime = lastAccessTime;
    this.validUntil = validUntil;
    this.State = State;
  }

  /**
   * Performs a deep copy on other.
   */
  public UserProfile(UserProfile other) {
    if (other.isSetUserModelVersion()) {
      this.userModelVersion = other.userModelVersion;
    }
    if (other.isSetAiravataInternalUserId()) {
      this.airavataInternalUserId = other.airavataInternalUserId;
    }
    if (other.isSetUserId()) {
      this.userId = other.userId;
    }
    if (other.isSetEmails()) {
      List __this__emails = new ArrayList(other.emails);
      this.emails = __this__emails;
    }
    if (other.isSetUserName()) {
      this.userName = other.userName;
    }
    if (other.isSetOrcidId()) {
      this.orcidId = other.orcidId;
    }
    if (other.isSetPhones()) {
      List __this__phones = new ArrayList(other.phones);
      this.phones = __this__phones;
    }
    if (other.isSetCountry()) {
      this.country = other.country;
    }
    if (other.isSetNationality()) {
      List __this__nationality = new ArrayList(other.nationality);
      this.nationality = __this__nationality;
    }
    if (other.isSetHomeOrganization()) {
      this.homeOrganization = other.homeOrganization;
    }
    if (other.isSetOrginationAffiliation()) {
      this.orginationAffiliation = other.orginationAffiliation;
    }
    if (other.isSetCreationTime()) {
      this.creationTime = other.creationTime;
    }
    if (other.isSetLastAccessTime()) {
      this.lastAccessTime = other.lastAccessTime;
    }
    if (other.isSetValidUntil()) {
      this.validUntil = other.validUntil;
    }
    if (other.isSetState()) {
      this.State = other.State;
    }
    if (other.isSetComments()) {
      this.comments = other.comments;
    }
    if (other.isSetLabeledURI()) {
      List __this__labeledURI = new ArrayList(other.labeledURI);
      this.labeledURI = __this__labeledURI;
    }
    if (other.isSetGpgKey()) {
      this.gpgKey = other.gpgKey;
    }
    if (other.isSetTimeZone()) {
      this.timeZone = other.timeZone;
    }
    if (other.isSetNsfDemographics()) {
      this.nsfDemographics = new NSFDemographics(other.nsfDemographics);
    }
  }

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

  @Override
  public void clear() {
    this.userModelVersion = "1.0";

    this.airavataInternalUserId = "DO_NOT_SET_AT_CLIENTS";

    this.userId = null;
    this.emails = null;
    this.userName = null;
    this.orcidId = null;
    this.phones = null;
    this.country = null;
    this.nationality = null;
    this.homeOrganization = null;
    this.orginationAffiliation = null;
    this.creationTime = null;
    this.lastAccessTime = null;
    this.validUntil = null;
    this.State = null;
    this.comments = null;
    this.labeledURI = null;
    this.gpgKey = null;
    this.timeZone = null;
    this.nsfDemographics = null;
  }

  public String getUserModelVersion() {
    return this.userModelVersion;
  }

  public void setUserModelVersion(String userModelVersion) {
    this.userModelVersion = userModelVersion;
  }

  public void unsetUserModelVersion() {
    this.userModelVersion = null;
  }

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

  public void setUserModelVersionIsSet(boolean value) {
    if (!value) {
      this.userModelVersion = null;
    }
  }

  public String getAiravataInternalUserId() {
    return this.airavataInternalUserId;
  }

  public void setAiravataInternalUserId(String airavataInternalUserId) {
    this.airavataInternalUserId = airavataInternalUserId;
  }

  public void unsetAiravataInternalUserId() {
    this.airavataInternalUserId = null;
  }

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

  public void setAiravataInternalUserIdIsSet(boolean value) {
    if (!value) {
      this.airavataInternalUserId = null;
    }
  }

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

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

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

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

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

  public int getEmailsSize() {
    return (this.emails == null) ? 0 : this.emails.size();
  }

  public java.util.Iterator getEmailsIterator() {
    return (this.emails == null) ? null : this.emails.iterator();
  }

  public void addToEmails(String elem) {
    if (this.emails == null) {
      this.emails = new ArrayList();
    }
    this.emails.add(elem);
  }

  public List getEmails() {
    return this.emails;
  }

  public void setEmails(List emails) {
    this.emails = emails;
  }

  public void unsetEmails() {
    this.emails = null;
  }

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

  public void setEmailsIsSet(boolean value) {
    if (!value) {
      this.emails = null;
    }
  }

  public String getUserName() {
    return this.userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public void unsetUserName() {
    this.userName = null;
  }

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

  public void setUserNameIsSet(boolean value) {
    if (!value) {
      this.userName = null;
    }
  }

  public String getOrcidId() {
    return this.orcidId;
  }

  public void setOrcidId(String orcidId) {
    this.orcidId = orcidId;
  }

  public void unsetOrcidId() {
    this.orcidId = null;
  }

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

  public void setOrcidIdIsSet(boolean value) {
    if (!value) {
      this.orcidId = null;
    }
  }

  public int getPhonesSize() {
    return (this.phones == null) ? 0 : this.phones.size();
  }

  public java.util.Iterator getPhonesIterator() {
    return (this.phones == null) ? null : this.phones.iterator();
  }

  public void addToPhones(String elem) {
    if (this.phones == null) {
      this.phones = new ArrayList();
    }
    this.phones.add(elem);
  }

  public List getPhones() {
    return this.phones;
  }

  public void setPhones(List phones) {
    this.phones = phones;
  }

  public void unsetPhones() {
    this.phones = null;
  }

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

  public void setPhonesIsSet(boolean value) {
    if (!value) {
      this.phones = null;
    }
  }

  public String getCountry() {
    return this.country;
  }

  public void setCountry(String country) {
    this.country = country;
  }

  public void unsetCountry() {
    this.country = null;
  }

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

  public void setCountryIsSet(boolean value) {
    if (!value) {
      this.country = null;
    }
  }

  public int getNationalitySize() {
    return (this.nationality == null) ? 0 : this.nationality.size();
  }

  public java.util.Iterator getNationalityIterator() {
    return (this.nationality == null) ? null : this.nationality.iterator();
  }

  public void addToNationality(String elem) {
    if (this.nationality == null) {
      this.nationality = new ArrayList();
    }
    this.nationality.add(elem);
  }

  public List getNationality() {
    return this.nationality;
  }

  public void setNationality(List nationality) {
    this.nationality = nationality;
  }

  public void unsetNationality() {
    this.nationality = null;
  }

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

  public void setNationalityIsSet(boolean value) {
    if (!value) {
      this.nationality = null;
    }
  }

  public String getHomeOrganization() {
    return this.homeOrganization;
  }

  public void setHomeOrganization(String homeOrganization) {
    this.homeOrganization = homeOrganization;
  }

  public void unsetHomeOrganization() {
    this.homeOrganization = null;
  }

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

  public void setHomeOrganizationIsSet(boolean value) {
    if (!value) {
      this.homeOrganization = null;
    }
  }

  public String getOrginationAffiliation() {
    return this.orginationAffiliation;
  }

  public void setOrginationAffiliation(String orginationAffiliation) {
    this.orginationAffiliation = orginationAffiliation;
  }

  public void unsetOrginationAffiliation() {
    this.orginationAffiliation = null;
  }

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

  public void setOrginationAffiliationIsSet(boolean value) {
    if (!value) {
      this.orginationAffiliation = null;
    }
  }

  public String getCreationTime() {
    return this.creationTime;
  }

  public void setCreationTime(String creationTime) {
    this.creationTime = creationTime;
  }

  public void unsetCreationTime() {
    this.creationTime = null;
  }

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

  public void setCreationTimeIsSet(boolean value) {
    if (!value) {
      this.creationTime = null;
    }
  }

  public String getLastAccessTime() {
    return this.lastAccessTime;
  }

  public void setLastAccessTime(String lastAccessTime) {
    this.lastAccessTime = lastAccessTime;
  }

  public void unsetLastAccessTime() {
    this.lastAccessTime = null;
  }

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

  public void setLastAccessTimeIsSet(boolean value) {
    if (!value) {
      this.lastAccessTime = null;
    }
  }

  public String getValidUntil() {
    return this.validUntil;
  }

  public void setValidUntil(String validUntil) {
    this.validUntil = validUntil;
  }

  public void unsetValidUntil() {
    this.validUntil = null;
  }

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

  public void setValidUntilIsSet(boolean value) {
    if (!value) {
      this.validUntil = null;
    }
  }

  /**
   * 
   * @see Status
   */
  public Status getState() {
    return this.State;
  }

  /**
   * 
   * @see Status
   */
  public void setState(Status State) {
    this.State = State;
  }

  public void unsetState() {
    this.State = null;
  }

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

  public void setStateIsSet(boolean value) {
    if (!value) {
      this.State = null;
    }
  }

  public String getComments() {
    return this.comments;
  }

  public void setComments(String comments) {
    this.comments = comments;
  }

  public void unsetComments() {
    this.comments = null;
  }

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

  public void setCommentsIsSet(boolean value) {
    if (!value) {
      this.comments = null;
    }
  }

  public int getLabeledURISize() {
    return (this.labeledURI == null) ? 0 : this.labeledURI.size();
  }

  public java.util.Iterator getLabeledURIIterator() {
    return (this.labeledURI == null) ? null : this.labeledURI.iterator();
  }

  public void addToLabeledURI(String elem) {
    if (this.labeledURI == null) {
      this.labeledURI = new ArrayList();
    }
    this.labeledURI.add(elem);
  }

  public List getLabeledURI() {
    return this.labeledURI;
  }

  public void setLabeledURI(List labeledURI) {
    this.labeledURI = labeledURI;
  }

  public void unsetLabeledURI() {
    this.labeledURI = null;
  }

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

  public void setLabeledURIIsSet(boolean value) {
    if (!value) {
      this.labeledURI = null;
    }
  }

  public String getGpgKey() {
    return this.gpgKey;
  }

  public void setGpgKey(String gpgKey) {
    this.gpgKey = gpgKey;
  }

  public void unsetGpgKey() {
    this.gpgKey = null;
  }

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

  public void setGpgKeyIsSet(boolean value) {
    if (!value) {
      this.gpgKey = null;
    }
  }

  public String getTimeZone() {
    return this.timeZone;
  }

  public void setTimeZone(String timeZone) {
    this.timeZone = timeZone;
  }

  public void unsetTimeZone() {
    this.timeZone = null;
  }

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

  public void setTimeZoneIsSet(boolean value) {
    if (!value) {
      this.timeZone = null;
    }
  }

  public NSFDemographics getNsfDemographics() {
    return this.nsfDemographics;
  }

  public void setNsfDemographics(NSFDemographics nsfDemographics) {
    this.nsfDemographics = nsfDemographics;
  }

  public void unsetNsfDemographics() {
    this.nsfDemographics = null;
  }

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

  public void setNsfDemographicsIsSet(boolean value) {
    if (!value) {
      this.nsfDemographics = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case USER_MODEL_VERSION:
      if (value == null) {
        unsetUserModelVersion();
      } else {
        setUserModelVersion((String)value);
      }
      break;

    case AIRAVATA_INTERNAL_USER_ID:
      if (value == null) {
        unsetAiravataInternalUserId();
      } else {
        setAiravataInternalUserId((String)value);
      }
      break;

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

    case EMAILS:
      if (value == null) {
        unsetEmails();
      } else {
        setEmails((List)value);
      }
      break;

    case USER_NAME:
      if (value == null) {
        unsetUserName();
      } else {
        setUserName((String)value);
      }
      break;

    case ORCID_ID:
      if (value == null) {
        unsetOrcidId();
      } else {
        setOrcidId((String)value);
      }
      break;

    case PHONES:
      if (value == null) {
        unsetPhones();
      } else {
        setPhones((List)value);
      }
      break;

    case COUNTRY:
      if (value == null) {
        unsetCountry();
      } else {
        setCountry((String)value);
      }
      break;

    case NATIONALITY:
      if (value == null) {
        unsetNationality();
      } else {
        setNationality((List)value);
      }
      break;

    case HOME_ORGANIZATION:
      if (value == null) {
        unsetHomeOrganization();
      } else {
        setHomeOrganization((String)value);
      }
      break;

    case ORGINATION_AFFILIATION:
      if (value == null) {
        unsetOrginationAffiliation();
      } else {
        setOrginationAffiliation((String)value);
      }
      break;

    case CREATION_TIME:
      if (value == null) {
        unsetCreationTime();
      } else {
        setCreationTime((String)value);
      }
      break;

    case LAST_ACCESS_TIME:
      if (value == null) {
        unsetLastAccessTime();
      } else {
        setLastAccessTime((String)value);
      }
      break;

    case VALID_UNTIL:
      if (value == null) {
        unsetValidUntil();
      } else {
        setValidUntil((String)value);
      }
      break;

    case STATE:
      if (value == null) {
        unsetState();
      } else {
        setState((Status)value);
      }
      break;

    case COMMENTS:
      if (value == null) {
        unsetComments();
      } else {
        setComments((String)value);
      }
      break;

    case LABELED_URI:
      if (value == null) {
        unsetLabeledURI();
      } else {
        setLabeledURI((List)value);
      }
      break;

    case GPG_KEY:
      if (value == null) {
        unsetGpgKey();
      } else {
        setGpgKey((String)value);
      }
      break;

    case TIME_ZONE:
      if (value == null) {
        unsetTimeZone();
      } else {
        setTimeZone((String)value);
      }
      break;

    case NSF_DEMOGRAPHICS:
      if (value == null) {
        unsetNsfDemographics();
      } else {
        setNsfDemographics((NSFDemographics)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case USER_MODEL_VERSION:
      return getUserModelVersion();

    case AIRAVATA_INTERNAL_USER_ID:
      return getAiravataInternalUserId();

    case USER_ID:
      return getUserId();

    case EMAILS:
      return getEmails();

    case USER_NAME:
      return getUserName();

    case ORCID_ID:
      return getOrcidId();

    case PHONES:
      return getPhones();

    case COUNTRY:
      return getCountry();

    case NATIONALITY:
      return getNationality();

    case HOME_ORGANIZATION:
      return getHomeOrganization();

    case ORGINATION_AFFILIATION:
      return getOrginationAffiliation();

    case CREATION_TIME:
      return getCreationTime();

    case LAST_ACCESS_TIME:
      return getLastAccessTime();

    case VALID_UNTIL:
      return getValidUntil();

    case STATE:
      return getState();

    case COMMENTS:
      return getComments();

    case LABELED_URI:
      return getLabeledURI();

    case GPG_KEY:
      return getGpgKey();

    case TIME_ZONE:
      return getTimeZone();

    case NSF_DEMOGRAPHICS:
      return getNsfDemographics();

    }
    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 USER_MODEL_VERSION:
      return isSetUserModelVersion();
    case AIRAVATA_INTERNAL_USER_ID:
      return isSetAiravataInternalUserId();
    case USER_ID:
      return isSetUserId();
    case EMAILS:
      return isSetEmails();
    case USER_NAME:
      return isSetUserName();
    case ORCID_ID:
      return isSetOrcidId();
    case PHONES:
      return isSetPhones();
    case COUNTRY:
      return isSetCountry();
    case NATIONALITY:
      return isSetNationality();
    case HOME_ORGANIZATION:
      return isSetHomeOrganization();
    case ORGINATION_AFFILIATION:
      return isSetOrginationAffiliation();
    case CREATION_TIME:
      return isSetCreationTime();
    case LAST_ACCESS_TIME:
      return isSetLastAccessTime();
    case VALID_UNTIL:
      return isSetValidUntil();
    case STATE:
      return isSetState();
    case COMMENTS:
      return isSetComments();
    case LABELED_URI:
      return isSetLabeledURI();
    case GPG_KEY:
      return isSetGpgKey();
    case TIME_ZONE:
      return isSetTimeZone();
    case NSF_DEMOGRAPHICS:
      return isSetNsfDemographics();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_userModelVersion = true && this.isSetUserModelVersion();
    boolean that_present_userModelVersion = true && that.isSetUserModelVersion();
    if (this_present_userModelVersion || that_present_userModelVersion) {
      if (!(this_present_userModelVersion && that_present_userModelVersion))
        return false;
      if (!this.userModelVersion.equals(that.userModelVersion))
        return false;
    }

    boolean this_present_airavataInternalUserId = true && this.isSetAiravataInternalUserId();
    boolean that_present_airavataInternalUserId = true && that.isSetAiravataInternalUserId();
    if (this_present_airavataInternalUserId || that_present_airavataInternalUserId) {
      if (!(this_present_airavataInternalUserId && that_present_airavataInternalUserId))
        return false;
      if (!this.airavataInternalUserId.equals(that.airavataInternalUserId))
        return false;
    }

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

    boolean this_present_emails = true && this.isSetEmails();
    boolean that_present_emails = true && that.isSetEmails();
    if (this_present_emails || that_present_emails) {
      if (!(this_present_emails && that_present_emails))
        return false;
      if (!this.emails.equals(that.emails))
        return false;
    }

    boolean this_present_userName = true && this.isSetUserName();
    boolean that_present_userName = true && that.isSetUserName();
    if (this_present_userName || that_present_userName) {
      if (!(this_present_userName && that_present_userName))
        return false;
      if (!this.userName.equals(that.userName))
        return false;
    }

    boolean this_present_orcidId = true && this.isSetOrcidId();
    boolean that_present_orcidId = true && that.isSetOrcidId();
    if (this_present_orcidId || that_present_orcidId) {
      if (!(this_present_orcidId && that_present_orcidId))
        return false;
      if (!this.orcidId.equals(that.orcidId))
        return false;
    }

    boolean this_present_phones = true && this.isSetPhones();
    boolean that_present_phones = true && that.isSetPhones();
    if (this_present_phones || that_present_phones) {
      if (!(this_present_phones && that_present_phones))
        return false;
      if (!this.phones.equals(that.phones))
        return false;
    }

    boolean this_present_country = true && this.isSetCountry();
    boolean that_present_country = true && that.isSetCountry();
    if (this_present_country || that_present_country) {
      if (!(this_present_country && that_present_country))
        return false;
      if (!this.country.equals(that.country))
        return false;
    }

    boolean this_present_nationality = true && this.isSetNationality();
    boolean that_present_nationality = true && that.isSetNationality();
    if (this_present_nationality || that_present_nationality) {
      if (!(this_present_nationality && that_present_nationality))
        return false;
      if (!this.nationality.equals(that.nationality))
        return false;
    }

    boolean this_present_homeOrganization = true && this.isSetHomeOrganization();
    boolean that_present_homeOrganization = true && that.isSetHomeOrganization();
    if (this_present_homeOrganization || that_present_homeOrganization) {
      if (!(this_present_homeOrganization && that_present_homeOrganization))
        return false;
      if (!this.homeOrganization.equals(that.homeOrganization))
        return false;
    }

    boolean this_present_orginationAffiliation = true && this.isSetOrginationAffiliation();
    boolean that_present_orginationAffiliation = true && that.isSetOrginationAffiliation();
    if (this_present_orginationAffiliation || that_present_orginationAffiliation) {
      if (!(this_present_orginationAffiliation && that_present_orginationAffiliation))
        return false;
      if (!this.orginationAffiliation.equals(that.orginationAffiliation))
        return false;
    }

    boolean this_present_creationTime = true && this.isSetCreationTime();
    boolean that_present_creationTime = true && that.isSetCreationTime();
    if (this_present_creationTime || that_present_creationTime) {
      if (!(this_present_creationTime && that_present_creationTime))
        return false;
      if (!this.creationTime.equals(that.creationTime))
        return false;
    }

    boolean this_present_lastAccessTime = true && this.isSetLastAccessTime();
    boolean that_present_lastAccessTime = true && that.isSetLastAccessTime();
    if (this_present_lastAccessTime || that_present_lastAccessTime) {
      if (!(this_present_lastAccessTime && that_present_lastAccessTime))
        return false;
      if (!this.lastAccessTime.equals(that.lastAccessTime))
        return false;
    }

    boolean this_present_validUntil = true && this.isSetValidUntil();
    boolean that_present_validUntil = true && that.isSetValidUntil();
    if (this_present_validUntil || that_present_validUntil) {
      if (!(this_present_validUntil && that_present_validUntil))
        return false;
      if (!this.validUntil.equals(that.validUntil))
        return false;
    }

    boolean this_present_State = true && this.isSetState();
    boolean that_present_State = true && that.isSetState();
    if (this_present_State || that_present_State) {
      if (!(this_present_State && that_present_State))
        return false;
      if (!this.State.equals(that.State))
        return false;
    }

    boolean this_present_comments = true && this.isSetComments();
    boolean that_present_comments = true && that.isSetComments();
    if (this_present_comments || that_present_comments) {
      if (!(this_present_comments && that_present_comments))
        return false;
      if (!this.comments.equals(that.comments))
        return false;
    }

    boolean this_present_labeledURI = true && this.isSetLabeledURI();
    boolean that_present_labeledURI = true && that.isSetLabeledURI();
    if (this_present_labeledURI || that_present_labeledURI) {
      if (!(this_present_labeledURI && that_present_labeledURI))
        return false;
      if (!this.labeledURI.equals(that.labeledURI))
        return false;
    }

    boolean this_present_gpgKey = true && this.isSetGpgKey();
    boolean that_present_gpgKey = true && that.isSetGpgKey();
    if (this_present_gpgKey || that_present_gpgKey) {
      if (!(this_present_gpgKey && that_present_gpgKey))
        return false;
      if (!this.gpgKey.equals(that.gpgKey))
        return false;
    }

    boolean this_present_timeZone = true && this.isSetTimeZone();
    boolean that_present_timeZone = true && that.isSetTimeZone();
    if (this_present_timeZone || that_present_timeZone) {
      if (!(this_present_timeZone && that_present_timeZone))
        return false;
      if (!this.timeZone.equals(that.timeZone))
        return false;
    }

    boolean this_present_nsfDemographics = true && this.isSetNsfDemographics();
    boolean that_present_nsfDemographics = true && that.isSetNsfDemographics();
    if (this_present_nsfDemographics || that_present_nsfDemographics) {
      if (!(this_present_nsfDemographics && that_present_nsfDemographics))
        return false;
      if (!this.nsfDemographics.equals(that.nsfDemographics))
        return false;
    }

    return true;
  }

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

    boolean present_userModelVersion = true && (isSetUserModelVersion());
    list.add(present_userModelVersion);
    if (present_userModelVersion)
      list.add(userModelVersion);

    boolean present_airavataInternalUserId = true && (isSetAiravataInternalUserId());
    list.add(present_airavataInternalUserId);
    if (present_airavataInternalUserId)
      list.add(airavataInternalUserId);

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

    boolean present_emails = true && (isSetEmails());
    list.add(present_emails);
    if (present_emails)
      list.add(emails);

    boolean present_userName = true && (isSetUserName());
    list.add(present_userName);
    if (present_userName)
      list.add(userName);

    boolean present_orcidId = true && (isSetOrcidId());
    list.add(present_orcidId);
    if (present_orcidId)
      list.add(orcidId);

    boolean present_phones = true && (isSetPhones());
    list.add(present_phones);
    if (present_phones)
      list.add(phones);

    boolean present_country = true && (isSetCountry());
    list.add(present_country);
    if (present_country)
      list.add(country);

    boolean present_nationality = true && (isSetNationality());
    list.add(present_nationality);
    if (present_nationality)
      list.add(nationality);

    boolean present_homeOrganization = true && (isSetHomeOrganization());
    list.add(present_homeOrganization);
    if (present_homeOrganization)
      list.add(homeOrganization);

    boolean present_orginationAffiliation = true && (isSetOrginationAffiliation());
    list.add(present_orginationAffiliation);
    if (present_orginationAffiliation)
      list.add(orginationAffiliation);

    boolean present_creationTime = true && (isSetCreationTime());
    list.add(present_creationTime);
    if (present_creationTime)
      list.add(creationTime);

    boolean present_lastAccessTime = true && (isSetLastAccessTime());
    list.add(present_lastAccessTime);
    if (present_lastAccessTime)
      list.add(lastAccessTime);

    boolean present_validUntil = true && (isSetValidUntil());
    list.add(present_validUntil);
    if (present_validUntil)
      list.add(validUntil);

    boolean present_State = true && (isSetState());
    list.add(present_State);
    if (present_State)
      list.add(State.getValue());

    boolean present_comments = true && (isSetComments());
    list.add(present_comments);
    if (present_comments)
      list.add(comments);

    boolean present_labeledURI = true && (isSetLabeledURI());
    list.add(present_labeledURI);
    if (present_labeledURI)
      list.add(labeledURI);

    boolean present_gpgKey = true && (isSetGpgKey());
    list.add(present_gpgKey);
    if (present_gpgKey)
      list.add(gpgKey);

    boolean present_timeZone = true && (isSetTimeZone());
    list.add(present_timeZone);
    if (present_timeZone)
      list.add(timeZone);

    boolean present_nsfDemographics = true && (isSetNsfDemographics());
    list.add(present_nsfDemographics);
    if (present_nsfDemographics)
      list.add(nsfDemographics);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetUserModelVersion()).compareTo(other.isSetUserModelVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserModelVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userModelVersion, other.userModelVersion);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAiravataInternalUserId()).compareTo(other.isSetAiravataInternalUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAiravataInternalUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.airavataInternalUserId, other.airavataInternalUserId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEmails()).compareTo(other.isSetEmails());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEmails()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.emails, other.emails);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUserName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrcidId()).compareTo(other.isSetOrcidId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrcidId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orcidId, other.orcidId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPhones()).compareTo(other.isSetPhones());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPhones()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.phones, other.phones);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCountry()).compareTo(other.isSetCountry());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCountry()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.country, other.country);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNationality()).compareTo(other.isSetNationality());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNationality()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nationality, other.nationality);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHomeOrganization()).compareTo(other.isSetHomeOrganization());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHomeOrganization()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.homeOrganization, other.homeOrganization);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrginationAffiliation()).compareTo(other.isSetOrginationAffiliation());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrginationAffiliation()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orginationAffiliation, other.orginationAffiliation);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreationTime()).compareTo(other.isSetCreationTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreationTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creationTime, other.creationTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLastAccessTime()).compareTo(other.isSetLastAccessTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLastAccessTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastAccessTime, other.lastAccessTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValidUntil()).compareTo(other.isSetValidUntil());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValidUntil()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validUntil, other.validUntil);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetState()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.State, other.State);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetComments()).compareTo(other.isSetComments());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComments()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comments, other.comments);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLabeledURI()).compareTo(other.isSetLabeledURI());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLabeledURI()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.labeledURI, other.labeledURI);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGpgKey()).compareTo(other.isSetGpgKey());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGpgKey()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gpgKey, other.gpgKey);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeZone()).compareTo(other.isSetTimeZone());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeZone()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeZone, other.timeZone);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNsfDemographics()).compareTo(other.isSetNsfDemographics());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNsfDemographics()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nsfDemographics, other.nsfDemographics);
      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("UserProfile(");
    boolean first = true;

    sb.append("userModelVersion:");
    if (this.userModelVersion == null) {
      sb.append("null");
    } else {
      sb.append(this.userModelVersion);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("airavataInternalUserId:");
    if (this.airavataInternalUserId == null) {
      sb.append("null");
    } else {
      sb.append(this.airavataInternalUserId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("userId:");
    if (this.userId == null) {
      sb.append("null");
    } else {
      sb.append(this.userId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("emails:");
    if (this.emails == null) {
      sb.append("null");
    } else {
      sb.append(this.emails);
    }
    first = false;
    if (isSetUserName()) {
      if (!first) sb.append(", ");
      sb.append("userName:");
      if (this.userName == null) {
        sb.append("null");
      } else {
        sb.append(this.userName);
      }
      first = false;
    }
    if (isSetOrcidId()) {
      if (!first) sb.append(", ");
      sb.append("orcidId:");
      if (this.orcidId == null) {
        sb.append("null");
      } else {
        sb.append(this.orcidId);
      }
      first = false;
    }
    if (isSetPhones()) {
      if (!first) sb.append(", ");
      sb.append("phones:");
      if (this.phones == null) {
        sb.append("null");
      } else {
        sb.append(this.phones);
      }
      first = false;
    }
    if (isSetCountry()) {
      if (!first) sb.append(", ");
      sb.append("country:");
      if (this.country == null) {
        sb.append("null");
      } else {
        sb.append(this.country);
      }
      first = false;
    }
    if (isSetNationality()) {
      if (!first) sb.append(", ");
      sb.append("nationality:");
      if (this.nationality == null) {
        sb.append("null");
      } else {
        sb.append(this.nationality);
      }
      first = false;
    }
    if (isSetHomeOrganization()) {
      if (!first) sb.append(", ");
      sb.append("homeOrganization:");
      if (this.homeOrganization == null) {
        sb.append("null");
      } else {
        sb.append(this.homeOrganization);
      }
      first = false;
    }
    if (isSetOrginationAffiliation()) {
      if (!first) sb.append(", ");
      sb.append("orginationAffiliation:");
      if (this.orginationAffiliation == null) {
        sb.append("null");
      } else {
        sb.append(this.orginationAffiliation);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("creationTime:");
    if (this.creationTime == null) {
      sb.append("null");
    } else {
      sb.append(this.creationTime);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("lastAccessTime:");
    if (this.lastAccessTime == null) {
      sb.append("null");
    } else {
      sb.append(this.lastAccessTime);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("validUntil:");
    if (this.validUntil == null) {
      sb.append("null");
    } else {
      sb.append(this.validUntil);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("State:");
    if (this.State == null) {
      sb.append("null");
    } else {
      sb.append(this.State);
    }
    first = false;
    if (isSetComments()) {
      if (!first) sb.append(", ");
      sb.append("comments:");
      if (this.comments == null) {
        sb.append("null");
      } else {
        sb.append(this.comments);
      }
      first = false;
    }
    if (isSetLabeledURI()) {
      if (!first) sb.append(", ");
      sb.append("labeledURI:");
      if (this.labeledURI == null) {
        sb.append("null");
      } else {
        sb.append(this.labeledURI);
      }
      first = false;
    }
    if (isSetGpgKey()) {
      if (!first) sb.append(", ");
      sb.append("gpgKey:");
      if (this.gpgKey == null) {
        sb.append("null");
      } else {
        sb.append(this.gpgKey);
      }
      first = false;
    }
    if (isSetTimeZone()) {
      if (!first) sb.append(", ");
      sb.append("timeZone:");
      if (this.timeZone == null) {
        sb.append("null");
      } else {
        sb.append(this.timeZone);
      }
      first = false;
    }
    if (isSetNsfDemographics()) {
      if (!first) sb.append(", ");
      sb.append("nsfDemographics:");
      if (this.nsfDemographics == null) {
        sb.append("null");
      } else {
        sb.append(this.nsfDemographics);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!isSetUserModelVersion()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userModelVersion' is unset! Struct:" + toString());
    }

    if (!isSetAiravataInternalUserId()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'airavataInternalUserId' is unset! Struct:" + toString());
    }

    if (!isSetUserId()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userId' is unset! Struct:" + toString());
    }

    if (!isSetEmails()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'emails' is unset! Struct:" + toString());
    }

    if (!isSetCreationTime()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'creationTime' is unset! Struct:" + toString());
    }

    if (!isSetLastAccessTime()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'lastAccessTime' is unset! Struct:" + toString());
    }

    if (!isSetValidUntil()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'validUntil' is unset! Struct:" + toString());
    }

    if (!isSetState()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'State' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
    if (nsfDemographics != null) {
      nsfDemographics.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 {
      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 UserProfileStandardSchemeFactory implements SchemeFactory {
    public UserProfileStandardScheme getScheme() {
      return new UserProfileStandardScheme();
    }
  }

  private static class UserProfileStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, UserProfile 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: // USER_MODEL_VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.userModelVersion = iprot.readString();
              struct.setUserModelVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // AIRAVATA_INTERNAL_USER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.airavataInternalUserId = iprot.readString();
              struct.setAiravataInternalUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // USER_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.userId = iprot.readString();
              struct.setUserIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // EMAILS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                struct.emails = new ArrayList(_list24.size);
                String _elem25;
                for (int _i26 = 0; _i26 < _list24.size; ++_i26)
                {
                  _elem25 = iprot.readString();
                  struct.emails.add(_elem25);
                }
                iprot.readListEnd();
              }
              struct.setEmailsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // USER_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.userName = iprot.readString();
              struct.setUserNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // ORCID_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.orcidId = iprot.readString();
              struct.setOrcidIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // PHONES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list27 = iprot.readListBegin();
                struct.phones = new ArrayList(_list27.size);
                String _elem28;
                for (int _i29 = 0; _i29 < _list27.size; ++_i29)
                {
                  _elem28 = iprot.readString();
                  struct.phones.add(_elem28);
                }
                iprot.readListEnd();
              }
              struct.setPhonesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // COUNTRY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.country = iprot.readString();
              struct.setCountryIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // NATIONALITY
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list30 = iprot.readListBegin();
                struct.nationality = new ArrayList(_list30.size);
                String _elem31;
                for (int _i32 = 0; _i32 < _list30.size; ++_i32)
                {
                  _elem31 = iprot.readString();
                  struct.nationality.add(_elem31);
                }
                iprot.readListEnd();
              }
              struct.setNationalityIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // HOME_ORGANIZATION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.homeOrganization = iprot.readString();
              struct.setHomeOrganizationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // ORGINATION_AFFILIATION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.orginationAffiliation = iprot.readString();
              struct.setOrginationAffiliationIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // CREATION_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.creationTime = iprot.readString();
              struct.setCreationTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // LAST_ACCESS_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.lastAccessTime = iprot.readString();
              struct.setLastAccessTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // VALID_UNTIL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.validUntil = iprot.readString();
              struct.setValidUntilIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // STATE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.State = org.apache.airavata.model.user.Status.findByValue(iprot.readI32());
              struct.setStateIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // COMMENTS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.comments = iprot.readString();
              struct.setCommentsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 17: // LABELED_URI
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list33 = iprot.readListBegin();
                struct.labeledURI = new ArrayList(_list33.size);
                String _elem34;
                for (int _i35 = 0; _i35 < _list33.size; ++_i35)
                {
                  _elem34 = iprot.readString();
                  struct.labeledURI.add(_elem34);
                }
                iprot.readListEnd();
              }
              struct.setLabeledURIIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 18: // GPG_KEY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.gpgKey = iprot.readString();
              struct.setGpgKeyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 19: // TIME_ZONE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.timeZone = iprot.readString();
              struct.setTimeZoneIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // NSF_DEMOGRAPHICS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.nsfDemographics = new NSFDemographics();
              struct.nsfDemographics.read(iprot);
              struct.setNsfDemographicsIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.userModelVersion != null) {
        oprot.writeFieldBegin(USER_MODEL_VERSION_FIELD_DESC);
        oprot.writeString(struct.userModelVersion);
        oprot.writeFieldEnd();
      }
      if (struct.airavataInternalUserId != null) {
        oprot.writeFieldBegin(AIRAVATA_INTERNAL_USER_ID_FIELD_DESC);
        oprot.writeString(struct.airavataInternalUserId);
        oprot.writeFieldEnd();
      }
      if (struct.userId != null) {
        oprot.writeFieldBegin(USER_ID_FIELD_DESC);
        oprot.writeString(struct.userId);
        oprot.writeFieldEnd();
      }
      if (struct.emails != null) {
        oprot.writeFieldBegin(EMAILS_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.emails.size()));
          for (String _iter36 : struct.emails)
          {
            oprot.writeString(_iter36);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.userName != null) {
        if (struct.isSetUserName()) {
          oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
          oprot.writeString(struct.userName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.orcidId != null) {
        if (struct.isSetOrcidId()) {
          oprot.writeFieldBegin(ORCID_ID_FIELD_DESC);
          oprot.writeString(struct.orcidId);
          oprot.writeFieldEnd();
        }
      }
      if (struct.phones != null) {
        if (struct.isSetPhones()) {
          oprot.writeFieldBegin(PHONES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.phones.size()));
            for (String _iter37 : struct.phones)
            {
              oprot.writeString(_iter37);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.country != null) {
        if (struct.isSetCountry()) {
          oprot.writeFieldBegin(COUNTRY_FIELD_DESC);
          oprot.writeString(struct.country);
          oprot.writeFieldEnd();
        }
      }
      if (struct.nationality != null) {
        if (struct.isSetNationality()) {
          oprot.writeFieldBegin(NATIONALITY_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.nationality.size()));
            for (String _iter38 : struct.nationality)
            {
              oprot.writeString(_iter38);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.homeOrganization != null) {
        if (struct.isSetHomeOrganization()) {
          oprot.writeFieldBegin(HOME_ORGANIZATION_FIELD_DESC);
          oprot.writeString(struct.homeOrganization);
          oprot.writeFieldEnd();
        }
      }
      if (struct.orginationAffiliation != null) {
        if (struct.isSetOrginationAffiliation()) {
          oprot.writeFieldBegin(ORGINATION_AFFILIATION_FIELD_DESC);
          oprot.writeString(struct.orginationAffiliation);
          oprot.writeFieldEnd();
        }
      }
      if (struct.creationTime != null) {
        oprot.writeFieldBegin(CREATION_TIME_FIELD_DESC);
        oprot.writeString(struct.creationTime);
        oprot.writeFieldEnd();
      }
      if (struct.lastAccessTime != null) {
        oprot.writeFieldBegin(LAST_ACCESS_TIME_FIELD_DESC);
        oprot.writeString(struct.lastAccessTime);
        oprot.writeFieldEnd();
      }
      if (struct.validUntil != null) {
        oprot.writeFieldBegin(VALID_UNTIL_FIELD_DESC);
        oprot.writeString(struct.validUntil);
        oprot.writeFieldEnd();
      }
      if (struct.State != null) {
        oprot.writeFieldBegin(STATE_FIELD_DESC);
        oprot.writeI32(struct.State.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.comments != null) {
        if (struct.isSetComments()) {
          oprot.writeFieldBegin(COMMENTS_FIELD_DESC);
          oprot.writeString(struct.comments);
          oprot.writeFieldEnd();
        }
      }
      if (struct.labeledURI != null) {
        if (struct.isSetLabeledURI()) {
          oprot.writeFieldBegin(LABELED_URI_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.labeledURI.size()));
            for (String _iter39 : struct.labeledURI)
            {
              oprot.writeString(_iter39);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.gpgKey != null) {
        if (struct.isSetGpgKey()) {
          oprot.writeFieldBegin(GPG_KEY_FIELD_DESC);
          oprot.writeString(struct.gpgKey);
          oprot.writeFieldEnd();
        }
      }
      if (struct.timeZone != null) {
        if (struct.isSetTimeZone()) {
          oprot.writeFieldBegin(TIME_ZONE_FIELD_DESC);
          oprot.writeString(struct.timeZone);
          oprot.writeFieldEnd();
        }
      }
      if (struct.nsfDemographics != null) {
        if (struct.isSetNsfDemographics()) {
          oprot.writeFieldBegin(NSF_DEMOGRAPHICS_FIELD_DESC);
          struct.nsfDemographics.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class UserProfileTupleSchemeFactory implements SchemeFactory {
    public UserProfileTupleScheme getScheme() {
      return new UserProfileTupleScheme();
    }
  }

  private static class UserProfileTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.userModelVersion);
      oprot.writeString(struct.airavataInternalUserId);
      oprot.writeString(struct.userId);
      {
        oprot.writeI32(struct.emails.size());
        for (String _iter40 : struct.emails)
        {
          oprot.writeString(_iter40);
        }
      }
      oprot.writeString(struct.creationTime);
      oprot.writeString(struct.lastAccessTime);
      oprot.writeString(struct.validUntil);
      oprot.writeI32(struct.State.getValue());
      BitSet optionals = new BitSet();
      if (struct.isSetUserName()) {
        optionals.set(0);
      }
      if (struct.isSetOrcidId()) {
        optionals.set(1);
      }
      if (struct.isSetPhones()) {
        optionals.set(2);
      }
      if (struct.isSetCountry()) {
        optionals.set(3);
      }
      if (struct.isSetNationality()) {
        optionals.set(4);
      }
      if (struct.isSetHomeOrganization()) {
        optionals.set(5);
      }
      if (struct.isSetOrginationAffiliation()) {
        optionals.set(6);
      }
      if (struct.isSetComments()) {
        optionals.set(7);
      }
      if (struct.isSetLabeledURI()) {
        optionals.set(8);
      }
      if (struct.isSetGpgKey()) {
        optionals.set(9);
      }
      if (struct.isSetTimeZone()) {
        optionals.set(10);
      }
      if (struct.isSetNsfDemographics()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetUserName()) {
        oprot.writeString(struct.userName);
      }
      if (struct.isSetOrcidId()) {
        oprot.writeString(struct.orcidId);
      }
      if (struct.isSetPhones()) {
        {
          oprot.writeI32(struct.phones.size());
          for (String _iter41 : struct.phones)
          {
            oprot.writeString(_iter41);
          }
        }
      }
      if (struct.isSetCountry()) {
        oprot.writeString(struct.country);
      }
      if (struct.isSetNationality()) {
        {
          oprot.writeI32(struct.nationality.size());
          for (String _iter42 : struct.nationality)
          {
            oprot.writeString(_iter42);
          }
        }
      }
      if (struct.isSetHomeOrganization()) {
        oprot.writeString(struct.homeOrganization);
      }
      if (struct.isSetOrginationAffiliation()) {
        oprot.writeString(struct.orginationAffiliation);
      }
      if (struct.isSetComments()) {
        oprot.writeString(struct.comments);
      }
      if (struct.isSetLabeledURI()) {
        {
          oprot.writeI32(struct.labeledURI.size());
          for (String _iter43 : struct.labeledURI)
          {
            oprot.writeString(_iter43);
          }
        }
      }
      if (struct.isSetGpgKey()) {
        oprot.writeString(struct.gpgKey);
      }
      if (struct.isSetTimeZone()) {
        oprot.writeString(struct.timeZone);
      }
      if (struct.isSetNsfDemographics()) {
        struct.nsfDemographics.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.userModelVersion = iprot.readString();
      struct.setUserModelVersionIsSet(true);
      struct.airavataInternalUserId = iprot.readString();
      struct.setAiravataInternalUserIdIsSet(true);
      struct.userId = iprot.readString();
      struct.setUserIdIsSet(true);
      {
        org.apache.thrift.protocol.TList _list44 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
        struct.emails = new ArrayList(_list44.size);
        String _elem45;
        for (int _i46 = 0; _i46 < _list44.size; ++_i46)
        {
          _elem45 = iprot.readString();
          struct.emails.add(_elem45);
        }
      }
      struct.setEmailsIsSet(true);
      struct.creationTime = iprot.readString();
      struct.setCreationTimeIsSet(true);
      struct.lastAccessTime = iprot.readString();
      struct.setLastAccessTimeIsSet(true);
      struct.validUntil = iprot.readString();
      struct.setValidUntilIsSet(true);
      struct.State = org.apache.airavata.model.user.Status.findByValue(iprot.readI32());
      struct.setStateIsSet(true);
      BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.userName = iprot.readString();
        struct.setUserNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.orcidId = iprot.readString();
        struct.setOrcidIdIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list47 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.phones = new ArrayList(_list47.size);
          String _elem48;
          for (int _i49 = 0; _i49 < _list47.size; ++_i49)
          {
            _elem48 = iprot.readString();
            struct.phones.add(_elem48);
          }
        }
        struct.setPhonesIsSet(true);
      }
      if (incoming.get(3)) {
        struct.country = iprot.readString();
        struct.setCountryIsSet(true);
      }
      if (incoming.get(4)) {
        {
          org.apache.thrift.protocol.TList _list50 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.nationality = new ArrayList(_list50.size);
          String _elem51;
          for (int _i52 = 0; _i52 < _list50.size; ++_i52)
          {
            _elem51 = iprot.readString();
            struct.nationality.add(_elem51);
          }
        }
        struct.setNationalityIsSet(true);
      }
      if (incoming.get(5)) {
        struct.homeOrganization = iprot.readString();
        struct.setHomeOrganizationIsSet(true);
      }
      if (incoming.get(6)) {
        struct.orginationAffiliation = iprot.readString();
        struct.setOrginationAffiliationIsSet(true);
      }
      if (incoming.get(7)) {
        struct.comments = iprot.readString();
        struct.setCommentsIsSet(true);
      }
      if (incoming.get(8)) {
        {
          org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.labeledURI = new ArrayList(_list53.size);
          String _elem54;
          for (int _i55 = 0; _i55 < _list53.size; ++_i55)
          {
            _elem54 = iprot.readString();
            struct.labeledURI.add(_elem54);
          }
        }
        struct.setLabeledURIIsSet(true);
      }
      if (incoming.get(9)) {
        struct.gpgKey = iprot.readString();
        struct.setGpgKeyIsSet(true);
      }
      if (incoming.get(10)) {
        struct.timeZone = iprot.readString();
        struct.setTimeZoneIsSet(true);
      }
      if (incoming.get(11)) {
        struct.nsfDemographics = new NSFDemographics();
        struct.nsfDemographics.read(iprot);
        struct.setNsfDemographicsIsSet(true);
      }
    }
  }

}