SENTRY-2192: supress date value in @Generated annotation generated by thrift.(Kalyan...
[sentry.git] / sentry-provider / sentry-provider-db / src / gen / thrift / gen-javabean / org / apache / sentry / provider / db / service / thrift / TAlterSentryRoleGrantPrivilegeRequest.java
1 /**
2 * Autogenerated by Thrift Compiler (0.9.3)
3 *
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated
6 */
7 package org.apache.sentry.provider.db.service.thrift;
8
9 import org.apache.thrift.scheme.IScheme;
10 import org.apache.thrift.scheme.SchemeFactory;
11 import org.apache.thrift.scheme.StandardScheme;
12
13 import org.apache.thrift.scheme.TupleScheme;
14 import org.apache.thrift.protocol.TTupleProtocol;
15 import org.apache.thrift.protocol.TProtocolException;
16 import org.apache.thrift.EncodingUtils;
17 import org.apache.thrift.TException;
18 import org.apache.thrift.async.AsyncMethodCallback;
19 import org.apache.thrift.server.AbstractNonblockingServer.*;
20 import java.util.List;
21 import java.util.ArrayList;
22 import java.util.Map;
23 import java.util.HashMap;
24 import java.util.EnumMap;
25 import java.util.Set;
26 import java.util.HashSet;
27 import java.util.EnumSet;
28 import java.util.Collections;
29 import java.util.BitSet;
30 import java.nio.ByteBuffer;
31 import java.util.Arrays;
32 import javax.annotation.Generated;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35
36 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
37 @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
38 public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TAlterSentryRoleGrantPrivilegeRequest> {
39 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
40
41 private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
42 private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
43 private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
44 private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
45 private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)6);
46
47 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
48 static {
49 schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
50 schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
51 }
52
53 private int protocol_version; // required
54 private String requestorUserName; // required
55 private String roleName; // required
56 private TSentryPrivilege privilege; // optional
57 private Set<TSentryPrivilege> privileges; // optional
58
59 /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
60 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
61 PROTOCOL_VERSION((short)1, "protocol_version"),
62 REQUESTOR_USER_NAME((short)2, "requestorUserName"),
63 ROLE_NAME((short)3, "roleName"),
64 PRIVILEGE((short)5, "privilege"),
65 PRIVILEGES((short)6, "privileges");
66
67 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
68
69 static {
70 for (_Fields field : EnumSet.allOf(_Fields.class)) {
71 byName.put(field.getFieldName(), field);
72 }
73 }
74
75 /**
76 * Find the _Fields constant that matches fieldId, or null if its not found.
77 */
78 public static _Fields findByThriftId(int fieldId) {
79 switch(fieldId) {
80 case 1: // PROTOCOL_VERSION
81 return PROTOCOL_VERSION;
82 case 2: // REQUESTOR_USER_NAME
83 return REQUESTOR_USER_NAME;
84 case 3: // ROLE_NAME
85 return ROLE_NAME;
86 case 5: // PRIVILEGE
87 return PRIVILEGE;
88 case 6: // PRIVILEGES
89 return PRIVILEGES;
90 default:
91 return null;
92 }
93 }
94
95 /**
96 * Find the _Fields constant that matches fieldId, throwing an exception
97 * if it is not found.
98 */
99 public static _Fields findByThriftIdOrThrow(int fieldId) {
100 _Fields fields = findByThriftId(fieldId);
101 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
102 return fields;
103 }
104
105 /**
106 * Find the _Fields constant that matches name, or null if its not found.
107 */
108 public static _Fields findByName(String name) {
109 return byName.get(name);
110 }
111
112 private final short _thriftId;
113 private final String _fieldName;
114
115 _Fields(short thriftId, String fieldName) {
116 _thriftId = thriftId;
117 _fieldName = fieldName;
118 }
119
120 public short getThriftFieldId() {
121 return _thriftId;
122 }
123
124 public String getFieldName() {
125 return _fieldName;
126 }
127 }
128
129 // isset id assignments
130 private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
131 private byte __isset_bitfield = 0;
132 private static final _Fields optionals[] = {_Fields.PRIVILEGE,_Fields.PRIVILEGES};
133 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
134 static {
135 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
136 tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
137 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
138 tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
139 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
140 tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
141 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
142 tmpMap.put(_Fields.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.OPTIONAL,
143 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class)));
144 tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
145 new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
146 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
147 metaDataMap = Collections.unmodifiableMap(tmpMap);
148 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
149 }
150
151 public TAlterSentryRoleGrantPrivilegeRequest() {
152 this.protocol_version = 2;
153
154 }
155
156 public TAlterSentryRoleGrantPrivilegeRequest(
157 int protocol_version,
158 String requestorUserName,
159 String roleName)
160 {
161 this();
162 this.protocol_version = protocol_version;
163 setProtocol_versionIsSet(true);
164 this.requestorUserName = requestorUserName;
165 this.roleName = roleName;
166 }
167
168 /**
169 * Performs a deep copy on <i>other</i>.
170 */
171 public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
172 __isset_bitfield = other.__isset_bitfield;
173 this.protocol_version = other.protocol_version;
174 if (other.isSetRequestorUserName()) {
175 this.requestorUserName = other.requestorUserName;
176 }
177 if (other.isSetRoleName()) {
178 this.roleName = other.roleName;
179 }
180 if (other.isSetPrivilege()) {
181 this.privilege = new TSentryPrivilege(other.privilege);
182 }
183 if (other.isSetPrivileges()) {
184 Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>(other.privileges.size());
185 for (TSentryPrivilege other_element : other.privileges) {
186 __this__privileges.add(new TSentryPrivilege(other_element));
187 }
188 this.privileges = __this__privileges;
189 }
190 }
191
192 public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
193 return new TAlterSentryRoleGrantPrivilegeRequest(this);
194 }
195
196 @Override
197 public void clear() {
198 this.protocol_version = 2;
199
200 this.requestorUserName = null;
201 this.roleName = null;
202 this.privilege = null;
203 this.privileges = null;
204 }
205
206 public int getProtocol_version() {
207 return this.protocol_version;
208 }
209
210 public void setProtocol_version(int protocol_version) {
211 this.protocol_version = protocol_version;
212 setProtocol_versionIsSet(true);
213 }
214
215 public void unsetProtocol_version() {
216 __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
217 }
218
219 /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
220 public boolean isSetProtocol_version() {
221 return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
222 }
223
224 public void setProtocol_versionIsSet(boolean value) {
225 __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
226 }
227
228 public String getRequestorUserName() {
229 return this.requestorUserName;
230 }
231
232 public void setRequestorUserName(String requestorUserName) {
233 this.requestorUserName = requestorUserName;
234 }
235
236 public void unsetRequestorUserName() {
237 this.requestorUserName = null;
238 }
239
240 /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
241 public boolean isSetRequestorUserName() {
242 return this.requestorUserName != null;
243 }
244
245 public void setRequestorUserNameIsSet(boolean value) {
246 if (!value) {
247 this.requestorUserName = null;
248 }
249 }
250
251 public String getRoleName() {
252 return this.roleName;
253 }
254
255 public void setRoleName(String roleName) {
256 this.roleName = roleName;
257 }
258
259 public void unsetRoleName() {
260 this.roleName = null;
261 }
262
263 /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
264 public boolean isSetRoleName() {
265 return this.roleName != null;
266 }
267
268 public void setRoleNameIsSet(boolean value) {
269 if (!value) {
270 this.roleName = null;
271 }
272 }
273
274 public TSentryPrivilege getPrivilege() {
275 return this.privilege;
276 }
277
278 public void setPrivilege(TSentryPrivilege privilege) {
279 this.privilege = privilege;
280 }
281
282 public void unsetPrivilege() {
283 this.privilege = null;
284 }
285
286 /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
287 public boolean isSetPrivilege() {
288 return this.privilege != null;
289 }
290
291 public void setPrivilegeIsSet(boolean value) {
292 if (!value) {
293 this.privilege = null;
294 }
295 }
296
297 public int getPrivilegesSize() {
298 return (this.privileges == null) ? 0 : this.privileges.size();
299 }
300
301 public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
302 return (this.privileges == null) ? null : this.privileges.iterator();
303 }
304
305 public void addToPrivileges(TSentryPrivilege elem) {
306 if (this.privileges == null) {
307 this.privileges = new HashSet<TSentryPrivilege>();
308 }
309 this.privileges.add(elem);
310 }
311
312 public Set<TSentryPrivilege> getPrivileges() {
313 return this.privileges;
314 }
315
316 public void setPrivileges(Set<TSentryPrivilege> privileges) {
317 this.privileges = privileges;
318 }
319
320 public void unsetPrivileges() {
321 this.privileges = null;
322 }
323
324 /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
325 public boolean isSetPrivileges() {
326 return this.privileges != null;
327 }
328
329 public void setPrivilegesIsSet(boolean value) {
330 if (!value) {
331 this.privileges = null;
332 }
333 }
334
335 public void setFieldValue(_Fields field, Object value) {
336 switch (field) {
337 case PROTOCOL_VERSION:
338 if (value == null) {
339 unsetProtocol_version();
340 } else {
341 setProtocol_version((Integer)value);
342 }
343 break;
344
345 case REQUESTOR_USER_NAME:
346 if (value == null) {
347 unsetRequestorUserName();
348 } else {
349 setRequestorUserName((String)value);
350 }
351 break;
352
353 case ROLE_NAME:
354 if (value == null) {
355 unsetRoleName();
356 } else {
357 setRoleName((String)value);
358 }
359 break;
360
361 case PRIVILEGE:
362 if (value == null) {
363 unsetPrivilege();
364 } else {
365 setPrivilege((TSentryPrivilege)value);
366 }
367 break;
368
369 case PRIVILEGES:
370 if (value == null) {
371 unsetPrivileges();
372 } else {
373 setPrivileges((Set<TSentryPrivilege>)value);
374 }
375 break;
376
377 }
378 }
379
380 public Object getFieldValue(_Fields field) {
381 switch (field) {
382 case PROTOCOL_VERSION:
383 return getProtocol_version();
384
385 case REQUESTOR_USER_NAME:
386 return getRequestorUserName();
387
388 case ROLE_NAME:
389 return getRoleName();
390
391 case PRIVILEGE:
392 return getPrivilege();
393
394 case PRIVILEGES:
395 return getPrivileges();
396
397 }
398 throw new IllegalStateException();
399 }
400
401 /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
402 public boolean isSet(_Fields field) {
403 if (field == null) {
404 throw new IllegalArgumentException();
405 }
406
407 switch (field) {
408 case PROTOCOL_VERSION:
409 return isSetProtocol_version();
410 case REQUESTOR_USER_NAME:
411 return isSetRequestorUserName();
412 case ROLE_NAME:
413 return isSetRoleName();
414 case PRIVILEGE:
415 return isSetPrivilege();
416 case PRIVILEGES:
417 return isSetPrivileges();
418 }
419 throw new IllegalStateException();
420 }
421
422 @Override
423 public boolean equals(Object that) {
424 if (that == null)
425 return false;
426 if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
427 return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
428 return false;
429 }
430
431 public boolean equals(TAlterSentryRoleGrantPrivilegeRequest that) {
432 if (that == null)
433 return false;
434
435 boolean this_present_protocol_version = true;
436 boolean that_present_protocol_version = true;
437 if (this_present_protocol_version || that_present_protocol_version) {
438 if (!(this_present_protocol_version && that_present_protocol_version))
439 return false;
440 if (this.protocol_version != that.protocol_version)
441 return false;
442 }
443
444 boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
445 boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
446 if (this_present_requestorUserName || that_present_requestorUserName) {
447 if (!(this_present_requestorUserName && that_present_requestorUserName))
448 return false;
449 if (!this.requestorUserName.equals(that.requestorUserName))
450 return false;
451 }
452
453 boolean this_present_roleName = true && this.isSetRoleName();
454 boolean that_present_roleName = true && that.isSetRoleName();
455 if (this_present_roleName || that_present_roleName) {
456 if (!(this_present_roleName && that_present_roleName))
457 return false;
458 if (!this.roleName.equals(that.roleName))
459 return false;
460 }
461
462 boolean this_present_privilege = true && this.isSetPrivilege();
463 boolean that_present_privilege = true && that.isSetPrivilege();
464 if (this_present_privilege || that_present_privilege) {
465 if (!(this_present_privilege && that_present_privilege))
466 return false;
467 if (!this.privilege.equals(that.privilege))
468 return false;
469 }
470
471 boolean this_present_privileges = true && this.isSetPrivileges();
472 boolean that_present_privileges = true && that.isSetPrivileges();
473 if (this_present_privileges || that_present_privileges) {
474 if (!(this_present_privileges && that_present_privileges))
475 return false;
476 if (!this.privileges.equals(that.privileges))
477 return false;
478 }
479
480 return true;
481 }
482
483 @Override
484 public int hashCode() {
485 List<Object> list = new ArrayList<Object>();
486
487 boolean present_protocol_version = true;
488 list.add(present_protocol_version);
489 if (present_protocol_version)
490 list.add(protocol_version);
491
492 boolean present_requestorUserName = true && (isSetRequestorUserName());
493 list.add(present_requestorUserName);
494 if (present_requestorUserName)
495 list.add(requestorUserName);
496
497 boolean present_roleName = true && (isSetRoleName());
498 list.add(present_roleName);
499 if (present_roleName)
500 list.add(roleName);
501
502 boolean present_privilege = true && (isSetPrivilege());
503 list.add(present_privilege);
504 if (present_privilege)
505 list.add(privilege);
506
507 boolean present_privileges = true && (isSetPrivileges());
508 list.add(present_privileges);
509 if (present_privileges)
510 list.add(privileges);
511
512 return list.hashCode();
513 }
514
515 @Override
516 public int compareTo(TAlterSentryRoleGrantPrivilegeRequest other) {
517 if (!getClass().equals(other.getClass())) {
518 return getClass().getName().compareTo(other.getClass().getName());
519 }
520
521 int lastComparison = 0;
522
523 lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(other.isSetProtocol_version());
524 if (lastComparison != 0) {
525 return lastComparison;
526 }
527 if (isSetProtocol_version()) {
528 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, other.protocol_version);
529 if (lastComparison != 0) {
530 return lastComparison;
531 }
532 }
533 lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(other.isSetRequestorUserName());
534 if (lastComparison != 0) {
535 return lastComparison;
536 }
537 if (isSetRequestorUserName()) {
538 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, other.requestorUserName);
539 if (lastComparison != 0) {
540 return lastComparison;
541 }
542 }
543 lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
544 if (lastComparison != 0) {
545 return lastComparison;
546 }
547 if (isSetRoleName()) {
548 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
549 if (lastComparison != 0) {
550 return lastComparison;
551 }
552 }
553 lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(other.isSetPrivilege());
554 if (lastComparison != 0) {
555 return lastComparison;
556 }
557 if (isSetPrivilege()) {
558 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, other.privilege);
559 if (lastComparison != 0) {
560 return lastComparison;
561 }
562 }
563 lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(other.isSetPrivileges());
564 if (lastComparison != 0) {
565 return lastComparison;
566 }
567 if (isSetPrivileges()) {
568 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, other.privileges);
569 if (lastComparison != 0) {
570 return lastComparison;
571 }
572 }
573 return 0;
574 }
575
576 public _Fields fieldForId(int fieldId) {
577 return _Fields.findByThriftId(fieldId);
578 }
579
580 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
581 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
582 }
583
584 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
585 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
586 }
587
588 @Override
589 public String toString() {
590 StringBuilder sb = new StringBuilder("TAlterSentryRoleGrantPrivilegeRequest(");
591 boolean first = true;
592
593 sb.append("protocol_version:");
594 sb.append(this.protocol_version);
595 first = false;
596 if (!first) sb.append(", ");
597 sb.append("requestorUserName:");
598 if (this.requestorUserName == null) {
599 sb.append("null");
600 } else {
601 sb.append(this.requestorUserName);
602 }
603 first = false;
604 if (!first) sb.append(", ");
605 sb.append("roleName:");
606 if (this.roleName == null) {
607 sb.append("null");
608 } else {
609 sb.append(this.roleName);
610 }
611 first = false;
612 if (isSetPrivilege()) {
613 if (!first) sb.append(", ");
614 sb.append("privilege:");
615 if (this.privilege == null) {
616 sb.append("null");
617 } else {
618 sb.append(this.privilege);
619 }
620 first = false;
621 }
622 if (isSetPrivileges()) {
623 if (!first) sb.append(", ");
624 sb.append("privileges:");
625 if (this.privileges == null) {
626 sb.append("null");
627 } else {
628 sb.append(this.privileges);
629 }
630 first = false;
631 }
632 sb.append(")");
633 return sb.toString();
634 }
635
636 public void validate() throws org.apache.thrift.TException {
637 // check for required fields
638 if (!isSetProtocol_version()) {
639 throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
640 }
641
642 if (!isSetRequestorUserName()) {
643 throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
644 }
645
646 if (!isSetRoleName()) {
647 throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
648 }
649
650 // check for sub-struct validity
651 if (privilege != null) {
652 privilege.validate();
653 }
654 }
655
656 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
657 try {
658 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
659 } catch (org.apache.thrift.TException te) {
660 throw new java.io.IOException(te);
661 }
662 }
663
664 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
665 try {
666 // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
667 __isset_bitfield = 0;
668 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
669 } catch (org.apache.thrift.TException te) {
670 throw new java.io.IOException(te);
671 }
672 }
673
674 private static class TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
675 public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
676 return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
677 }
678 }
679
680 private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
681
682 public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
683 org.apache.thrift.protocol.TField schemeField;
684 iprot.readStructBegin();
685 while (true)
686 {
687 schemeField = iprot.readFieldBegin();
688 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
689 break;
690 }
691 switch (schemeField.id) {
692 case 1: // PROTOCOL_VERSION
693 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
694 struct.protocol_version = iprot.readI32();
695 struct.setProtocol_versionIsSet(true);
696 } else {
697 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
698 }
699 break;
700 case 2: // REQUESTOR_USER_NAME
701 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
702 struct.requestorUserName = iprot.readString();
703 struct.setRequestorUserNameIsSet(true);
704 } else {
705 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
706 }
707 break;
708 case 3: // ROLE_NAME
709 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
710 struct.roleName = iprot.readString();
711 struct.setRoleNameIsSet(true);
712 } else {
713 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
714 }
715 break;
716 case 5: // PRIVILEGE
717 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
718 struct.privilege = new TSentryPrivilege();
719 struct.privilege.read(iprot);
720 struct.setPrivilegeIsSet(true);
721 } else {
722 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
723 }
724 break;
725 case 6: // PRIVILEGES
726 if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
727 {
728 org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
729 struct.privileges = new HashSet<TSentryPrivilege>(2*_set32.size);
730 TSentryPrivilege _elem33;
731 for (int _i34 = 0; _i34 < _set32.size; ++_i34)
732 {
733 _elem33 = new TSentryPrivilege();
734 _elem33.read(iprot);
735 struct.privileges.add(_elem33);
736 }
737 iprot.readSetEnd();
738 }
739 struct.setPrivilegesIsSet(true);
740 } else {
741 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
742 }
743 break;
744 default:
745 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
746 }
747 iprot.readFieldEnd();
748 }
749 iprot.readStructEnd();
750 struct.validate();
751 }
752
753 public void write(org.apache.thrift.protocol.TProtocol oprot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
754 struct.validate();
755
756 oprot.writeStructBegin(STRUCT_DESC);
757 oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
758 oprot.writeI32(struct.protocol_version);
759 oprot.writeFieldEnd();
760 if (struct.requestorUserName != null) {
761 oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
762 oprot.writeString(struct.requestorUserName);
763 oprot.writeFieldEnd();
764 }
765 if (struct.roleName != null) {
766 oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
767 oprot.writeString(struct.roleName);
768 oprot.writeFieldEnd();
769 }
770 if (struct.privilege != null) {
771 if (struct.isSetPrivilege()) {
772 oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
773 struct.privilege.write(oprot);
774 oprot.writeFieldEnd();
775 }
776 }
777 if (struct.privileges != null) {
778 if (struct.isSetPrivileges()) {
779 oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
780 {
781 oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
782 for (TSentryPrivilege _iter35 : struct.privileges)
783 {
784 _iter35.write(oprot);
785 }
786 oprot.writeSetEnd();
787 }
788 oprot.writeFieldEnd();
789 }
790 }
791 oprot.writeFieldStop();
792 oprot.writeStructEnd();
793 }
794
795 }
796
797 private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
798 public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
799 return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
800 }
801 }
802
803 private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
804
805 @Override
806 public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
807 TTupleProtocol oprot = (TTupleProtocol) prot;
808 oprot.writeI32(struct.protocol_version);
809 oprot.writeString(struct.requestorUserName);
810 oprot.writeString(struct.roleName);
811 BitSet optionals = new BitSet();
812 if (struct.isSetPrivilege()) {
813 optionals.set(0);
814 }
815 if (struct.isSetPrivileges()) {
816 optionals.set(1);
817 }
818 oprot.writeBitSet(optionals, 2);
819 if (struct.isSetPrivilege()) {
820 struct.privilege.write(oprot);
821 }
822 if (struct.isSetPrivileges()) {
823 {
824 oprot.writeI32(struct.privileges.size());
825 for (TSentryPrivilege _iter36 : struct.privileges)
826 {
827 _iter36.write(oprot);
828 }
829 }
830 }
831 }
832
833 @Override
834 public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
835 TTupleProtocol iprot = (TTupleProtocol) prot;
836 struct.protocol_version = iprot.readI32();
837 struct.setProtocol_versionIsSet(true);
838 struct.requestorUserName = iprot.readString();
839 struct.setRequestorUserNameIsSet(true);
840 struct.roleName = iprot.readString();
841 struct.setRoleNameIsSet(true);
842 BitSet incoming = iprot.readBitSet(2);
843 if (incoming.get(0)) {
844 struct.privilege = new TSentryPrivilege();
845 struct.privilege.read(iprot);
846 struct.setPrivilegeIsSet(true);
847 }
848 if (incoming.get(1)) {
849 {
850 org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
851 struct.privileges = new HashSet<TSentryPrivilege>(2*_set37.size);
852 TSentryPrivilege _elem38;
853 for (int _i39 = 0; _i39 < _set37.size; ++_i39)
854 {
855 _elem38 = new TSentryPrivilege();
856 _elem38.read(iprot);
857 struct.privileges.add(_elem38);
858 }
859 }
860 struct.setPrivilegesIsSet(true);
861 }
862 }
863 }
864
865 }
866