Java tutorial
/* Copyright (C) 2013-2014 Computer Sciences Corporation * * Licensed 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.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package ezbake.base.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 org.slf4j.Logger; import org.slf4j.LoggerFactory; public class EzSecurityToken implements org.apache.thrift.TBase<EzSecurityToken, EzSecurityToken._Fields>, java.io.Serializable, Cloneable, Comparable<EzSecurityToken> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct( "EzSecurityToken"); private static final org.apache.thrift.protocol.TField VALIDITY_FIELD_DESC = new org.apache.thrift.protocol.TField( "validity", org.apache.thrift.protocol.TType.STRUCT, (short) 1); private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField( "type", org.apache.thrift.protocol.TType.I32, (short) 2); private static final org.apache.thrift.protocol.TField TOKEN_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField( "tokenPrincipal", org.apache.thrift.protocol.TType.STRUCT, (short) 3); private static final org.apache.thrift.protocol.TField AUTHORIZATION_LEVEL_FIELD_DESC = new org.apache.thrift.protocol.TField( "authorizationLevel", org.apache.thrift.protocol.TType.STRING, (short) 10); private static final org.apache.thrift.protocol.TField AUTHORIZATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField( "authorizations", org.apache.thrift.protocol.TType.STRUCT, (short) 11); private static final org.apache.thrift.protocol.TField EXTERNAL_PROJECT_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField( "externalProjectGroups", org.apache.thrift.protocol.TType.MAP, (short) 13); private static final org.apache.thrift.protocol.TField EXTERNAL_COMMUNITIES_FIELD_DESC = new org.apache.thrift.protocol.TField( "externalCommunities", org.apache.thrift.protocol.TType.MAP, (short) 14); private static final org.apache.thrift.protocol.TField CITIZENSHIP_FIELD_DESC = new org.apache.thrift.protocol.TField( "citizenship", org.apache.thrift.protocol.TType.STRING, (short) 15); private static final org.apache.thrift.protocol.TField ORGANIZATION_FIELD_DESC = new org.apache.thrift.protocol.TField( "organization", org.apache.thrift.protocol.TType.STRING, (short) 16); private static final org.apache.thrift.protocol.TField VALID_FOR_EXTERNAL_REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField( "validForExternalRequest", org.apache.thrift.protocol.TType.BOOL, (short) 17); private static final org.apache.thrift.protocol.TField EXTERNAL_REQUEST_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField( "externalRequestPrincipal", org.apache.thrift.protocol.TType.STRING, (short) 18); private static final org.apache.thrift.protocol.TField EXTERNAL_REQUEST_PRINCIPAL_ISSUER_FIELD_DESC = new org.apache.thrift.protocol.TField( "externalRequestPrincipalIssuer", org.apache.thrift.protocol.TType.STRING, (short) 19); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new EzSecurityTokenStandardSchemeFactory()); schemes.put(TupleScheme.class, new EzSecurityTokenTupleSchemeFactory()); } public ValidityCaveats validity; // required /** * * @see TokenType */ public TokenType type; // required public EzSecurityPrincipal tokenPrincipal; // required public String authorizationLevel; // optional public ezbake.base.thrift.Authorizations authorizations; // optional public Map<String, List<String>> externalProjectGroups; // optional public Map<String, CommunityMembership> externalCommunities; // optional public String citizenship; // optional public String organization; // optional public boolean validForExternalRequest; // optional public String externalRequestPrincipal; // optional public String externalRequestPrincipalIssuer; // 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 { VALIDITY((short) 1, "validity"), /** * * @see TokenType */ TYPE((short) 2, "type"), TOKEN_PRINCIPAL((short) 3, "tokenPrincipal"), AUTHORIZATION_LEVEL((short) 10, "authorizationLevel"), AUTHORIZATIONS((short) 11, "authorizations"), EXTERNAL_PROJECT_GROUPS( (short) 13, "externalProjectGroups"), EXTERNAL_COMMUNITIES((short) 14, "externalCommunities"), CITIZENSHIP((short) 15, "citizenship"), ORGANIZATION( (short) 16, "organization"), VALID_FOR_EXTERNAL_REQUEST((short) 17, "validForExternalRequest"), EXTERNAL_REQUEST_PRINCIPAL((short) 18, "externalRequestPrincipal"), EXTERNAL_REQUEST_PRINCIPAL_ISSUER( (short) 19, "externalRequestPrincipalIssuer"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch (fieldId) { case 1: // VALIDITY return VALIDITY; case 2: // TYPE return TYPE; case 3: // TOKEN_PRINCIPAL return TOKEN_PRINCIPAL; case 10: // AUTHORIZATION_LEVEL return AUTHORIZATION_LEVEL; case 11: // AUTHORIZATIONS return AUTHORIZATIONS; case 13: // EXTERNAL_PROJECT_GROUPS return EXTERNAL_PROJECT_GROUPS; case 14: // EXTERNAL_COMMUNITIES return EXTERNAL_COMMUNITIES; case 15: // CITIZENSHIP return CITIZENSHIP; case 16: // ORGANIZATION return ORGANIZATION; case 17: // VALID_FOR_EXTERNAL_REQUEST return VALID_FOR_EXTERNAL_REQUEST; case 18: // EXTERNAL_REQUEST_PRINCIPAL return EXTERNAL_REQUEST_PRINCIPAL; case 19: // EXTERNAL_REQUEST_PRINCIPAL_ISSUER return EXTERNAL_REQUEST_PRINCIPAL_ISSUER; 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 __VALIDFOREXTERNALREQUEST_ISSET_ID = 0; private byte __isset_bitfield = 0; private _Fields optionals[] = { _Fields.AUTHORIZATION_LEVEL, _Fields.AUTHORIZATIONS, _Fields.EXTERNAL_PROJECT_GROUPS, _Fields.EXTERNAL_COMMUNITIES, _Fields.CITIZENSHIP, _Fields.ORGANIZATION, _Fields.VALID_FOR_EXTERNAL_REQUEST, _Fields.EXTERNAL_REQUEST_PRINCIPAL, _Fields.EXTERNAL_REQUEST_PRINCIPAL_ISSUER }; 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.VALIDITY, new org.apache.thrift.meta_data.FieldMetaData("validity", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ValidityCaveats.class))); tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TokenType.class))); tmpMap.put(_Fields.TOKEN_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("tokenPrincipal", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, EzSecurityPrincipal.class))); tmpMap.put(_Fields.AUTHORIZATION_LEVEL, new org.apache.thrift.meta_data.FieldMetaData("authorizationLevel", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.AUTHORIZATIONS, new org.apache.thrift.meta_data.FieldMetaData("authorizations", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ezbake.base.thrift.Authorizations.class))); tmpMap.put(_Fields.EXTERNAL_PROJECT_GROUPS, new org.apache.thrift.meta_data.FieldMetaData( "externalProjectGroups", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 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.EXTERNAL_COMMUNITIES, new org.apache.thrift.meta_data.FieldMetaData( "externalCommunities", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CommunityMembership.class)))); tmpMap.put(_Fields.CITIZENSHIP, new org.apache.thrift.meta_data.FieldMetaData("citizenship", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.ORGANIZATION, new org.apache.thrift.meta_data.FieldMetaData("organization", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.VALID_FOR_EXTERNAL_REQUEST, new org.apache.thrift.meta_data.FieldMetaData("validForExternalRequest", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.EXTERNAL_REQUEST_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData( "externalRequestPrincipal", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.EXTERNAL_REQUEST_PRINCIPAL_ISSUER, new org.apache.thrift.meta_data.FieldMetaData( "externalRequestPrincipalIssuer", 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(EzSecurityToken.class, metaDataMap); } public EzSecurityToken() { this.type = ezbake.base.thrift.TokenType.USER; this.validForExternalRequest = false; } public EzSecurityToken(ValidityCaveats validity, TokenType type, EzSecurityPrincipal tokenPrincipal) { this(); this.validity = validity; this.type = type; this.tokenPrincipal = tokenPrincipal; } /** * Performs a deep copy on <i>other</i>. */ public EzSecurityToken(EzSecurityToken other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetValidity()) { this.validity = new ValidityCaveats(other.validity); } if (other.isSetType()) { this.type = other.type; } if (other.isSetTokenPrincipal()) { this.tokenPrincipal = new EzSecurityPrincipal(other.tokenPrincipal); } if (other.isSetAuthorizationLevel()) { this.authorizationLevel = other.authorizationLevel; } if (other.isSetAuthorizations()) { this.authorizations = new ezbake.base.thrift.Authorizations(other.authorizations); } if (other.isSetExternalProjectGroups()) { Map<String, List<String>> __this__externalProjectGroups = new HashMap<String, List<String>>( other.externalProjectGroups.size()); for (Map.Entry<String, List<String>> other_element : other.externalProjectGroups.entrySet()) { String other_element_key = other_element.getKey(); List<String> other_element_value = other_element.getValue(); String __this__externalProjectGroups_copy_key = other_element_key; List<String> __this__externalProjectGroups_copy_value = new ArrayList<String>(other_element_value); __this__externalProjectGroups.put(__this__externalProjectGroups_copy_key, __this__externalProjectGroups_copy_value); } this.externalProjectGroups = __this__externalProjectGroups; } if (other.isSetExternalCommunities()) { Map<String, CommunityMembership> __this__externalCommunities = new HashMap<String, CommunityMembership>( other.externalCommunities.size()); for (Map.Entry<String, CommunityMembership> other_element : other.externalCommunities.entrySet()) { String other_element_key = other_element.getKey(); CommunityMembership other_element_value = other_element.getValue(); String __this__externalCommunities_copy_key = other_element_key; CommunityMembership __this__externalCommunities_copy_value = new CommunityMembership( other_element_value); __this__externalCommunities.put(__this__externalCommunities_copy_key, __this__externalCommunities_copy_value); } this.externalCommunities = __this__externalCommunities; } if (other.isSetCitizenship()) { this.citizenship = other.citizenship; } if (other.isSetOrganization()) { this.organization = other.organization; } this.validForExternalRequest = other.validForExternalRequest; if (other.isSetExternalRequestPrincipal()) { this.externalRequestPrincipal = other.externalRequestPrincipal; } if (other.isSetExternalRequestPrincipalIssuer()) { this.externalRequestPrincipalIssuer = other.externalRequestPrincipalIssuer; } } public EzSecurityToken deepCopy() { return new EzSecurityToken(this); } @Override public void clear() { this.validity = null; this.type = ezbake.base.thrift.TokenType.USER; this.tokenPrincipal = null; this.authorizationLevel = null; this.authorizations = null; this.externalProjectGroups = null; this.externalCommunities = null; this.citizenship = null; this.organization = null; this.validForExternalRequest = false; this.externalRequestPrincipal = null; this.externalRequestPrincipalIssuer = null; } public ValidityCaveats getValidity() { return this.validity; } public EzSecurityToken setValidity(ValidityCaveats validity) { this.validity = validity; return this; } public void unsetValidity() { this.validity = null; } /** Returns true if field validity is set (has been assigned a value) and false otherwise */ public boolean isSetValidity() { return this.validity != null; } public void setValidityIsSet(boolean value) { if (!value) { this.validity = null; } } /** * * @see TokenType */ public TokenType getType() { return this.type; } /** * * @see TokenType */ public EzSecurityToken setType(TokenType type) { this.type = type; return this; } public void unsetType() { this.type = null; } /** Returns true if field type is set (has been assigned a value) and false otherwise */ public boolean isSetType() { return this.type != null; } public void setTypeIsSet(boolean value) { if (!value) { this.type = null; } } public EzSecurityPrincipal getTokenPrincipal() { return this.tokenPrincipal; } public EzSecurityToken setTokenPrincipal(EzSecurityPrincipal tokenPrincipal) { this.tokenPrincipal = tokenPrincipal; return this; } public void unsetTokenPrincipal() { this.tokenPrincipal = null; } /** Returns true if field tokenPrincipal is set (has been assigned a value) and false otherwise */ public boolean isSetTokenPrincipal() { return this.tokenPrincipal != null; } public void setTokenPrincipalIsSet(boolean value) { if (!value) { this.tokenPrincipal = null; } } public String getAuthorizationLevel() { return this.authorizationLevel; } public EzSecurityToken setAuthorizationLevel(String authorizationLevel) { this.authorizationLevel = authorizationLevel; return this; } public void unsetAuthorizationLevel() { this.authorizationLevel = null; } /** Returns true if field authorizationLevel is set (has been assigned a value) and false otherwise */ public boolean isSetAuthorizationLevel() { return this.authorizationLevel != null; } public void setAuthorizationLevelIsSet(boolean value) { if (!value) { this.authorizationLevel = null; } } public ezbake.base.thrift.Authorizations getAuthorizations() { return this.authorizations; } public EzSecurityToken setAuthorizations(ezbake.base.thrift.Authorizations authorizations) { this.authorizations = authorizations; return this; } public void unsetAuthorizations() { this.authorizations = null; } /** Returns true if field authorizations is set (has been assigned a value) and false otherwise */ public boolean isSetAuthorizations() { return this.authorizations != null; } public void setAuthorizationsIsSet(boolean value) { if (!value) { this.authorizations = null; } } public int getExternalProjectGroupsSize() { return (this.externalProjectGroups == null) ? 0 : this.externalProjectGroups.size(); } public void putToExternalProjectGroups(String key, List<String> val) { if (this.externalProjectGroups == null) { this.externalProjectGroups = new HashMap<String, List<String>>(); } this.externalProjectGroups.put(key, val); } public Map<String, List<String>> getExternalProjectGroups() { return this.externalProjectGroups; } public EzSecurityToken setExternalProjectGroups(Map<String, List<String>> externalProjectGroups) { this.externalProjectGroups = externalProjectGroups; return this; } public void unsetExternalProjectGroups() { this.externalProjectGroups = null; } /** Returns true if field externalProjectGroups is set (has been assigned a value) and false otherwise */ public boolean isSetExternalProjectGroups() { return this.externalProjectGroups != null; } public void setExternalProjectGroupsIsSet(boolean value) { if (!value) { this.externalProjectGroups = null; } } public int getExternalCommunitiesSize() { return (this.externalCommunities == null) ? 0 : this.externalCommunities.size(); } public void putToExternalCommunities(String key, CommunityMembership val) { if (this.externalCommunities == null) { this.externalCommunities = new HashMap<String, CommunityMembership>(); } this.externalCommunities.put(key, val); } public Map<String, CommunityMembership> getExternalCommunities() { return this.externalCommunities; } public EzSecurityToken setExternalCommunities(Map<String, CommunityMembership> externalCommunities) { this.externalCommunities = externalCommunities; return this; } public void unsetExternalCommunities() { this.externalCommunities = null; } /** Returns true if field externalCommunities is set (has been assigned a value) and false otherwise */ public boolean isSetExternalCommunities() { return this.externalCommunities != null; } public void setExternalCommunitiesIsSet(boolean value) { if (!value) { this.externalCommunities = null; } } public String getCitizenship() { return this.citizenship; } public EzSecurityToken setCitizenship(String citizenship) { this.citizenship = citizenship; return this; } public void unsetCitizenship() { this.citizenship = null; } /** Returns true if field citizenship is set (has been assigned a value) and false otherwise */ public boolean isSetCitizenship() { return this.citizenship != null; } public void setCitizenshipIsSet(boolean value) { if (!value) { this.citizenship = null; } } public String getOrganization() { return this.organization; } public EzSecurityToken setOrganization(String organization) { this.organization = organization; return this; } public void unsetOrganization() { this.organization = null; } /** Returns true if field organization is set (has been assigned a value) and false otherwise */ public boolean isSetOrganization() { return this.organization != null; } public void setOrganizationIsSet(boolean value) { if (!value) { this.organization = null; } } public boolean isValidForExternalRequest() { return this.validForExternalRequest; } public EzSecurityToken setValidForExternalRequest(boolean validForExternalRequest) { this.validForExternalRequest = validForExternalRequest; setValidForExternalRequestIsSet(true); return this; } public void unsetValidForExternalRequest() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALIDFOREXTERNALREQUEST_ISSET_ID); } /** Returns true if field validForExternalRequest is set (has been assigned a value) and false otherwise */ public boolean isSetValidForExternalRequest() { return EncodingUtils.testBit(__isset_bitfield, __VALIDFOREXTERNALREQUEST_ISSET_ID); } public void setValidForExternalRequestIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALIDFOREXTERNALREQUEST_ISSET_ID, value); } public String getExternalRequestPrincipal() { return this.externalRequestPrincipal; } public EzSecurityToken setExternalRequestPrincipal(String externalRequestPrincipal) { this.externalRequestPrincipal = externalRequestPrincipal; return this; } public void unsetExternalRequestPrincipal() { this.externalRequestPrincipal = null; } /** Returns true if field externalRequestPrincipal is set (has been assigned a value) and false otherwise */ public boolean isSetExternalRequestPrincipal() { return this.externalRequestPrincipal != null; } public void setExternalRequestPrincipalIsSet(boolean value) { if (!value) { this.externalRequestPrincipal = null; } } public String getExternalRequestPrincipalIssuer() { return this.externalRequestPrincipalIssuer; } public EzSecurityToken setExternalRequestPrincipalIssuer(String externalRequestPrincipalIssuer) { this.externalRequestPrincipalIssuer = externalRequestPrincipalIssuer; return this; } public void unsetExternalRequestPrincipalIssuer() { this.externalRequestPrincipalIssuer = null; } /** Returns true if field externalRequestPrincipalIssuer is set (has been assigned a value) and false otherwise */ public boolean isSetExternalRequestPrincipalIssuer() { return this.externalRequestPrincipalIssuer != null; } public void setExternalRequestPrincipalIssuerIsSet(boolean value) { if (!value) { this.externalRequestPrincipalIssuer = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case VALIDITY: if (value == null) { unsetValidity(); } else { setValidity((ValidityCaveats) value); } break; case TYPE: if (value == null) { unsetType(); } else { setType((TokenType) value); } break; case TOKEN_PRINCIPAL: if (value == null) { unsetTokenPrincipal(); } else { setTokenPrincipal((EzSecurityPrincipal) value); } break; case AUTHORIZATION_LEVEL: if (value == null) { unsetAuthorizationLevel(); } else { setAuthorizationLevel((String) value); } break; case AUTHORIZATIONS: if (value == null) { unsetAuthorizations(); } else { setAuthorizations((ezbake.base.thrift.Authorizations) value); } break; case EXTERNAL_PROJECT_GROUPS: if (value == null) { unsetExternalProjectGroups(); } else { setExternalProjectGroups((Map<String, List<String>>) value); } break; case EXTERNAL_COMMUNITIES: if (value == null) { unsetExternalCommunities(); } else { setExternalCommunities((Map<String, CommunityMembership>) value); } break; case CITIZENSHIP: if (value == null) { unsetCitizenship(); } else { setCitizenship((String) value); } break; case ORGANIZATION: if (value == null) { unsetOrganization(); } else { setOrganization((String) value); } break; case VALID_FOR_EXTERNAL_REQUEST: if (value == null) { unsetValidForExternalRequest(); } else { setValidForExternalRequest((Boolean) value); } break; case EXTERNAL_REQUEST_PRINCIPAL: if (value == null) { unsetExternalRequestPrincipal(); } else { setExternalRequestPrincipal((String) value); } break; case EXTERNAL_REQUEST_PRINCIPAL_ISSUER: if (value == null) { unsetExternalRequestPrincipalIssuer(); } else { setExternalRequestPrincipalIssuer((String) value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case VALIDITY: return getValidity(); case TYPE: return getType(); case TOKEN_PRINCIPAL: return getTokenPrincipal(); case AUTHORIZATION_LEVEL: return getAuthorizationLevel(); case AUTHORIZATIONS: return getAuthorizations(); case EXTERNAL_PROJECT_GROUPS: return getExternalProjectGroups(); case EXTERNAL_COMMUNITIES: return getExternalCommunities(); case CITIZENSHIP: return getCitizenship(); case ORGANIZATION: return getOrganization(); case VALID_FOR_EXTERNAL_REQUEST: return Boolean.valueOf(isValidForExternalRequest()); case EXTERNAL_REQUEST_PRINCIPAL: return getExternalRequestPrincipal(); case EXTERNAL_REQUEST_PRINCIPAL_ISSUER: return getExternalRequestPrincipalIssuer(); } 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 VALIDITY: return isSetValidity(); case TYPE: return isSetType(); case TOKEN_PRINCIPAL: return isSetTokenPrincipal(); case AUTHORIZATION_LEVEL: return isSetAuthorizationLevel(); case AUTHORIZATIONS: return isSetAuthorizations(); case EXTERNAL_PROJECT_GROUPS: return isSetExternalProjectGroups(); case EXTERNAL_COMMUNITIES: return isSetExternalCommunities(); case CITIZENSHIP: return isSetCitizenship(); case ORGANIZATION: return isSetOrganization(); case VALID_FOR_EXTERNAL_REQUEST: return isSetValidForExternalRequest(); case EXTERNAL_REQUEST_PRINCIPAL: return isSetExternalRequestPrincipal(); case EXTERNAL_REQUEST_PRINCIPAL_ISSUER: return isSetExternalRequestPrincipalIssuer(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof EzSecurityToken) return this.equals((EzSecurityToken) that); return false; } public boolean equals(EzSecurityToken that) { if (that == null) return false; boolean this_present_validity = true && this.isSetValidity(); boolean that_present_validity = true && that.isSetValidity(); if (this_present_validity || that_present_validity) { if (!(this_present_validity && that_present_validity)) return false; if (!this.validity.equals(that.validity)) return false; } boolean this_present_type = true && this.isSetType(); boolean that_present_type = true && that.isSetType(); if (this_present_type || that_present_type) { if (!(this_present_type && that_present_type)) return false; if (!this.type.equals(that.type)) return false; } boolean this_present_tokenPrincipal = true && this.isSetTokenPrincipal(); boolean that_present_tokenPrincipal = true && that.isSetTokenPrincipal(); if (this_present_tokenPrincipal || that_present_tokenPrincipal) { if (!(this_present_tokenPrincipal && that_present_tokenPrincipal)) return false; if (!this.tokenPrincipal.equals(that.tokenPrincipal)) return false; } boolean this_present_authorizationLevel = true && this.isSetAuthorizationLevel(); boolean that_present_authorizationLevel = true && that.isSetAuthorizationLevel(); if (this_present_authorizationLevel || that_present_authorizationLevel) { if (!(this_present_authorizationLevel && that_present_authorizationLevel)) return false; if (!this.authorizationLevel.equals(that.authorizationLevel)) return false; } boolean this_present_authorizations = true && this.isSetAuthorizations(); boolean that_present_authorizations = true && that.isSetAuthorizations(); if (this_present_authorizations || that_present_authorizations) { if (!(this_present_authorizations && that_present_authorizations)) return false; if (!this.authorizations.equals(that.authorizations)) return false; } boolean this_present_externalProjectGroups = true && this.isSetExternalProjectGroups(); boolean that_present_externalProjectGroups = true && that.isSetExternalProjectGroups(); if (this_present_externalProjectGroups || that_present_externalProjectGroups) { if (!(this_present_externalProjectGroups && that_present_externalProjectGroups)) return false; if (!this.externalProjectGroups.equals(that.externalProjectGroups)) return false; } boolean this_present_externalCommunities = true && this.isSetExternalCommunities(); boolean that_present_externalCommunities = true && that.isSetExternalCommunities(); if (this_present_externalCommunities || that_present_externalCommunities) { if (!(this_present_externalCommunities && that_present_externalCommunities)) return false; if (!this.externalCommunities.equals(that.externalCommunities)) return false; } boolean this_present_citizenship = true && this.isSetCitizenship(); boolean that_present_citizenship = true && that.isSetCitizenship(); if (this_present_citizenship || that_present_citizenship) { if (!(this_present_citizenship && that_present_citizenship)) return false; if (!this.citizenship.equals(that.citizenship)) return false; } boolean this_present_organization = true && this.isSetOrganization(); boolean that_present_organization = true && that.isSetOrganization(); if (this_present_organization || that_present_organization) { if (!(this_present_organization && that_present_organization)) return false; if (!this.organization.equals(that.organization)) return false; } boolean this_present_validForExternalRequest = true && this.isSetValidForExternalRequest(); boolean that_present_validForExternalRequest = true && that.isSetValidForExternalRequest(); if (this_present_validForExternalRequest || that_present_validForExternalRequest) { if (!(this_present_validForExternalRequest && that_present_validForExternalRequest)) return false; if (this.validForExternalRequest != that.validForExternalRequest) return false; } boolean this_present_externalRequestPrincipal = true && this.isSetExternalRequestPrincipal(); boolean that_present_externalRequestPrincipal = true && that.isSetExternalRequestPrincipal(); if (this_present_externalRequestPrincipal || that_present_externalRequestPrincipal) { if (!(this_present_externalRequestPrincipal && that_present_externalRequestPrincipal)) return false; if (!this.externalRequestPrincipal.equals(that.externalRequestPrincipal)) return false; } boolean this_present_externalRequestPrincipalIssuer = true && this.isSetExternalRequestPrincipalIssuer(); boolean that_present_externalRequestPrincipalIssuer = true && that.isSetExternalRequestPrincipalIssuer(); if (this_present_externalRequestPrincipalIssuer || that_present_externalRequestPrincipalIssuer) { if (!(this_present_externalRequestPrincipalIssuer && that_present_externalRequestPrincipalIssuer)) return false; if (!this.externalRequestPrincipalIssuer.equals(that.externalRequestPrincipalIssuer)) return false; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(EzSecurityToken other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetValidity()).compareTo(other.isSetValidity()); if (lastComparison != 0) { return lastComparison; } if (isSetValidity()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validity, other.validity); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType()); if (lastComparison != 0) { return lastComparison; } if (isSetType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetTokenPrincipal()).compareTo(other.isSetTokenPrincipal()); if (lastComparison != 0) { return lastComparison; } if (isSetTokenPrincipal()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokenPrincipal, other.tokenPrincipal); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetAuthorizationLevel()).compareTo(other.isSetAuthorizationLevel()); if (lastComparison != 0) { return lastComparison; } if (isSetAuthorizationLevel()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizationLevel, other.authorizationLevel); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetAuthorizations()).compareTo(other.isSetAuthorizations()); if (lastComparison != 0) { return lastComparison; } if (isSetAuthorizations()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizations, other.authorizations); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExternalProjectGroups()) .compareTo(other.isSetExternalProjectGroups()); if (lastComparison != 0) { return lastComparison; } if (isSetExternalProjectGroups()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.externalProjectGroups, other.externalProjectGroups); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExternalCommunities()).compareTo(other.isSetExternalCommunities()); if (lastComparison != 0) { return lastComparison; } if (isSetExternalCommunities()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.externalCommunities, other.externalCommunities); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetCitizenship()).compareTo(other.isSetCitizenship()); if (lastComparison != 0) { return lastComparison; } if (isSetCitizenship()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.citizenship, other.citizenship); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetOrganization()).compareTo(other.isSetOrganization()); if (lastComparison != 0) { return lastComparison; } if (isSetOrganization()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.organization, other.organization); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetValidForExternalRequest()) .compareTo(other.isSetValidForExternalRequest()); if (lastComparison != 0) { return lastComparison; } if (isSetValidForExternalRequest()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validForExternalRequest, other.validForExternalRequest); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExternalRequestPrincipal()) .compareTo(other.isSetExternalRequestPrincipal()); if (lastComparison != 0) { return lastComparison; } if (isSetExternalRequestPrincipal()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.externalRequestPrincipal, other.externalRequestPrincipal); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExternalRequestPrincipalIssuer()) .compareTo(other.isSetExternalRequestPrincipalIssuer()); if (lastComparison != 0) { return lastComparison; } if (isSetExternalRequestPrincipalIssuer()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.externalRequestPrincipalIssuer, other.externalRequestPrincipalIssuer); 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("EzSecurityToken("); boolean first = true; sb.append("validity:"); if (this.validity == null) { sb.append("null"); } else { sb.append(this.validity); } first = false; if (!first) sb.append(", "); sb.append("type:"); if (this.type == null) { sb.append("null"); } else { sb.append(this.type); } first = false; if (!first) sb.append(", "); sb.append("tokenPrincipal:"); if (this.tokenPrincipal == null) { sb.append("null"); } else { sb.append(this.tokenPrincipal); } first = false; if (isSetAuthorizationLevel()) { if (!first) sb.append(", "); sb.append("authorizationLevel:"); if (this.authorizationLevel == null) { sb.append("null"); } else { sb.append(this.authorizationLevel); } first = false; } if (isSetAuthorizations()) { if (!first) sb.append(", "); sb.append("authorizations:"); if (this.authorizations == null) { sb.append("null"); } else { sb.append(this.authorizations); } first = false; } if (isSetExternalProjectGroups()) { if (!first) sb.append(", "); sb.append("externalProjectGroups:"); if (this.externalProjectGroups == null) { sb.append("null"); } else { sb.append(this.externalProjectGroups); } first = false; } if (isSetExternalCommunities()) { if (!first) sb.append(", "); sb.append("externalCommunities:"); if (this.externalCommunities == null) { sb.append("null"); } else { sb.append(this.externalCommunities); } first = false; } if (isSetCitizenship()) { if (!first) sb.append(", "); sb.append("citizenship:"); if (this.citizenship == null) { sb.append("null"); } else { sb.append(this.citizenship); } first = false; } if (isSetOrganization()) { if (!first) sb.append(", "); sb.append("organization:"); if (this.organization == null) { sb.append("null"); } else { sb.append(this.organization); } first = false; } if (isSetValidForExternalRequest()) { if (!first) sb.append(", "); sb.append("validForExternalRequest:"); sb.append(this.validForExternalRequest); first = false; } if (isSetExternalRequestPrincipal()) { if (!first) sb.append(", "); sb.append("externalRequestPrincipal:"); if (this.externalRequestPrincipal == null) { sb.append("null"); } else { sb.append(this.externalRequestPrincipal); } first = false; } if (isSetExternalRequestPrincipalIssuer()) { if (!first) sb.append(", "); sb.append("externalRequestPrincipalIssuer:"); if (this.externalRequestPrincipalIssuer == null) { sb.append("null"); } else { sb.append(this.externalRequestPrincipalIssuer); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (validity == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'validity' was not present! Struct: " + toString()); } if (type == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'type' was not present! Struct: " + toString()); } if (tokenPrincipal == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'tokenPrincipal' was not present! Struct: " + toString()); } // check for sub-struct validity if (validity != null) { validity.validate(); } if (tokenPrincipal != null) { tokenPrincipal.validate(); } if (authorizations != null) { authorizations.validate(); } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol( new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol( new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class EzSecurityTokenStandardSchemeFactory implements SchemeFactory { public EzSecurityTokenStandardScheme getScheme() { return new EzSecurityTokenStandardScheme(); } } private static class EzSecurityTokenStandardScheme extends StandardScheme<EzSecurityToken> { public void read(org.apache.thrift.protocol.TProtocol iprot, EzSecurityToken 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: // VALIDITY if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.validity = new ValidityCaveats(); struct.validity.read(iprot); struct.setValidityIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.type = TokenType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // TOKEN_PRINCIPAL if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.tokenPrincipal = new EzSecurityPrincipal(); struct.tokenPrincipal.read(iprot); struct.setTokenPrincipalIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 10: // AUTHORIZATION_LEVEL if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.authorizationLevel = iprot.readString(); struct.setAuthorizationLevelIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 11: // AUTHORIZATIONS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.authorizations = new ezbake.base.thrift.Authorizations(); struct.authorizations.read(iprot); struct.setAuthorizationsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 13: // EXTERNAL_PROJECT_GROUPS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map72 = iprot.readMapBegin(); struct.externalProjectGroups = new HashMap<String, List<String>>(2 * _map72.size); for (int _i73 = 0; _i73 < _map72.size; ++_i73) { String _key74; List<String> _val75; _key74 = iprot.readString(); { org.apache.thrift.protocol.TList _list76 = iprot.readListBegin(); _val75 = new ArrayList<String>(_list76.size); for (int _i77 = 0; _i77 < _list76.size; ++_i77) { String _elem78; _elem78 = iprot.readString(); _val75.add(_elem78); } iprot.readListEnd(); } struct.externalProjectGroups.put(_key74, _val75); } iprot.readMapEnd(); } struct.setExternalProjectGroupsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 14: // EXTERNAL_COMMUNITIES if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { org.apache.thrift.protocol.TMap _map79 = iprot.readMapBegin(); struct.externalCommunities = new HashMap<String, CommunityMembership>(2 * _map79.size); for (int _i80 = 0; _i80 < _map79.size; ++_i80) { String _key81; CommunityMembership _val82; _key81 = iprot.readString(); _val82 = new CommunityMembership(); _val82.read(iprot); struct.externalCommunities.put(_key81, _val82); } iprot.readMapEnd(); } struct.setExternalCommunitiesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 15: // CITIZENSHIP if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.citizenship = iprot.readString(); struct.setCitizenshipIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 16: // ORGANIZATION if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.organization = iprot.readString(); struct.setOrganizationIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 17: // VALID_FOR_EXTERNAL_REQUEST if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.validForExternalRequest = iprot.readBool(); struct.setValidForExternalRequestIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 18: // EXTERNAL_REQUEST_PRINCIPAL if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.externalRequestPrincipal = iprot.readString(); struct.setExternalRequestPrincipalIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 19: // EXTERNAL_REQUEST_PRINCIPAL_ISSUER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.externalRequestPrincipalIssuer = iprot.readString(); struct.setExternalRequestPrincipalIssuerIsSet(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, EzSecurityToken struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.validity != null) { oprot.writeFieldBegin(VALIDITY_FIELD_DESC); struct.validity.write(oprot); oprot.writeFieldEnd(); } if (struct.type != null) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } if (struct.tokenPrincipal != null) { oprot.writeFieldBegin(TOKEN_PRINCIPAL_FIELD_DESC); struct.tokenPrincipal.write(oprot); oprot.writeFieldEnd(); } if (struct.authorizationLevel != null) { if (struct.isSetAuthorizationLevel()) { oprot.writeFieldBegin(AUTHORIZATION_LEVEL_FIELD_DESC); oprot.writeString(struct.authorizationLevel); oprot.writeFieldEnd(); } } if (struct.authorizations != null) { if (struct.isSetAuthorizations()) { oprot.writeFieldBegin(AUTHORIZATIONS_FIELD_DESC); struct.authorizations.write(oprot); oprot.writeFieldEnd(); } } if (struct.externalProjectGroups != null) { if (struct.isSetExternalProjectGroups()) { oprot.writeFieldBegin(EXTERNAL_PROJECT_GROUPS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, struct.externalProjectGroups.size())); for (Map.Entry<String, List<String>> _iter83 : struct.externalProjectGroups.entrySet()) { oprot.writeString(_iter83.getKey()); { oprot.writeListBegin(new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, _iter83.getValue().size())); for (String _iter84 : _iter83.getValue()) { oprot.writeString(_iter84); } oprot.writeListEnd(); } } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } } if (struct.externalCommunities != null) { if (struct.isSetExternalCommunities()) { oprot.writeFieldBegin(EXTERNAL_COMMUNITIES_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.externalCommunities.size())); for (Map.Entry<String, CommunityMembership> _iter85 : struct.externalCommunities .entrySet()) { oprot.writeString(_iter85.getKey()); _iter85.getValue().write(oprot); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } } if (struct.citizenship != null) { if (struct.isSetCitizenship()) { oprot.writeFieldBegin(CITIZENSHIP_FIELD_DESC); oprot.writeString(struct.citizenship); oprot.writeFieldEnd(); } } if (struct.organization != null) { if (struct.isSetOrganization()) { oprot.writeFieldBegin(ORGANIZATION_FIELD_DESC); oprot.writeString(struct.organization); oprot.writeFieldEnd(); } } if (struct.isSetValidForExternalRequest()) { oprot.writeFieldBegin(VALID_FOR_EXTERNAL_REQUEST_FIELD_DESC); oprot.writeBool(struct.validForExternalRequest); oprot.writeFieldEnd(); } if (struct.externalRequestPrincipal != null) { if (struct.isSetExternalRequestPrincipal()) { oprot.writeFieldBegin(EXTERNAL_REQUEST_PRINCIPAL_FIELD_DESC); oprot.writeString(struct.externalRequestPrincipal); oprot.writeFieldEnd(); } } if (struct.externalRequestPrincipalIssuer != null) { if (struct.isSetExternalRequestPrincipalIssuer()) { oprot.writeFieldBegin(EXTERNAL_REQUEST_PRINCIPAL_ISSUER_FIELD_DESC); oprot.writeString(struct.externalRequestPrincipalIssuer); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class EzSecurityTokenTupleSchemeFactory implements SchemeFactory { public EzSecurityTokenTupleScheme getScheme() { return new EzSecurityTokenTupleScheme(); } } private static class EzSecurityTokenTupleScheme extends TupleScheme<EzSecurityToken> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, EzSecurityToken struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.validity.write(oprot); oprot.writeI32(struct.type.getValue()); struct.tokenPrincipal.write(oprot); BitSet optionals = new BitSet(); if (struct.isSetAuthorizationLevel()) { optionals.set(0); } if (struct.isSetAuthorizations()) { optionals.set(1); } if (struct.isSetExternalProjectGroups()) { optionals.set(2); } if (struct.isSetExternalCommunities()) { optionals.set(3); } if (struct.isSetCitizenship()) { optionals.set(4); } if (struct.isSetOrganization()) { optionals.set(5); } if (struct.isSetValidForExternalRequest()) { optionals.set(6); } if (struct.isSetExternalRequestPrincipal()) { optionals.set(7); } if (struct.isSetExternalRequestPrincipalIssuer()) { optionals.set(8); } oprot.writeBitSet(optionals, 9); if (struct.isSetAuthorizationLevel()) { oprot.writeString(struct.authorizationLevel); } if (struct.isSetAuthorizations()) { struct.authorizations.write(oprot); } if (struct.isSetExternalProjectGroups()) { { oprot.writeI32(struct.externalProjectGroups.size()); for (Map.Entry<String, List<String>> _iter86 : struct.externalProjectGroups.entrySet()) { oprot.writeString(_iter86.getKey()); { oprot.writeI32(_iter86.getValue().size()); for (String _iter87 : _iter86.getValue()) { oprot.writeString(_iter87); } } } } } if (struct.isSetExternalCommunities()) { { oprot.writeI32(struct.externalCommunities.size()); for (Map.Entry<String, CommunityMembership> _iter88 : struct.externalCommunities.entrySet()) { oprot.writeString(_iter88.getKey()); _iter88.getValue().write(oprot); } } } if (struct.isSetCitizenship()) { oprot.writeString(struct.citizenship); } if (struct.isSetOrganization()) { oprot.writeString(struct.organization); } if (struct.isSetValidForExternalRequest()) { oprot.writeBool(struct.validForExternalRequest); } if (struct.isSetExternalRequestPrincipal()) { oprot.writeString(struct.externalRequestPrincipal); } if (struct.isSetExternalRequestPrincipalIssuer()) { oprot.writeString(struct.externalRequestPrincipalIssuer); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, EzSecurityToken struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.validity = new ValidityCaveats(); struct.validity.read(iprot); struct.setValidityIsSet(true); struct.type = TokenType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); struct.tokenPrincipal = new EzSecurityPrincipal(); struct.tokenPrincipal.read(iprot); struct.setTokenPrincipalIsSet(true); BitSet incoming = iprot.readBitSet(9); if (incoming.get(0)) { struct.authorizationLevel = iprot.readString(); struct.setAuthorizationLevelIsSet(true); } if (incoming.get(1)) { struct.authorizations = new ezbake.base.thrift.Authorizations(); struct.authorizations.read(iprot); struct.setAuthorizationsIsSet(true); } if (incoming.get(2)) { { org.apache.thrift.protocol.TMap _map89 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.LIST, iprot.readI32()); struct.externalProjectGroups = new HashMap<String, List<String>>(2 * _map89.size); for (int _i90 = 0; _i90 < _map89.size; ++_i90) { String _key91; List<String> _val92; _key91 = iprot.readString(); { org.apache.thrift.protocol.TList _list93 = new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRING, iprot.readI32()); _val92 = new ArrayList<String>(_list93.size); for (int _i94 = 0; _i94 < _list93.size; ++_i94) { String _elem95; _elem95 = iprot.readString(); _val92.add(_elem95); } } struct.externalProjectGroups.put(_key91, _val92); } } struct.setExternalProjectGroupsIsSet(true); } if (incoming.get(3)) { { org.apache.thrift.protocol.TMap _map96 = new org.apache.thrift.protocol.TMap( org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.externalCommunities = new HashMap<String, CommunityMembership>(2 * _map96.size); for (int _i97 = 0; _i97 < _map96.size; ++_i97) { String _key98; CommunityMembership _val99; _key98 = iprot.readString(); _val99 = new CommunityMembership(); _val99.read(iprot); struct.externalCommunities.put(_key98, _val99); } } struct.setExternalCommunitiesIsSet(true); } if (incoming.get(4)) { struct.citizenship = iprot.readString(); struct.setCitizenshipIsSet(true); } if (incoming.get(5)) { struct.organization = iprot.readString(); struct.setOrganizationIsSet(true); } if (incoming.get(6)) { struct.validForExternalRequest = iprot.readBool(); struct.setValidForExternalRequestIsSet(true); } if (incoming.get(7)) { struct.externalRequestPrincipal = iprot.readString(); struct.setExternalRequestPrincipalIsSet(true); } if (incoming.get(8)) { struct.externalRequestPrincipalIssuer = iprot.readString(); struct.setExternalRequestPrincipalIssuerIsSet(true); } } } }