public TAuthorization deepCopy() { return new TAuthorization(this); }
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { switch (field) { case LABELS: if (value == null) { unsetLabels(); } else { setLabels((java.util.List<java.lang.String>)value); } break; } }
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TAuthorization) return this.equals((TAuthorization)that); return false; }
public void write(org.apache.thrift.protocol.TProtocol oprot, TAuthorization struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.labels != null) { if (struct.isSetLabels()) { oprot.writeFieldBegin(LABELS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.labels.size())); for (java.lang.String _iter11 : struct.labels) { oprot.writeString(_iter11); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
struct.setLabelsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
@Test public void testGetsWithLabels() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testPutGet"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValues = new ArrayList<>(2); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname))); columnValues.add(new TColumnValue(wrap(familyBname), wrap(qualifierBname), wrap(valueBname))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); put.setCellVisibility(new TCellVisibility().setExpression("(" + SECRET + "|" + CONFIDENTIAL + ")" + "&" + "!" + TOPSECRET)); handler.put(table, put); TGet get = new TGet(wrap(rowName)); TAuthorization tauth = new TAuthorization(); List<String> labels = new ArrayList<>(2); labels.add(SECRET); labels.add(PRIVATE); tauth.setLabels(labels); get.setAuthorizations(tauth); TResult result = handler.get(table, get); assertArrayEquals(rowName, result.getRow()); List<TColumnValue> returnedColumnValues = result.getColumnValues(); assertTColumnValuesEqual(columnValues, returnedColumnValues); }
struct.authorizations = new TAuthorization(); struct.authorizations.read(iprot); struct.setAuthorizationsIsSet(true);
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); } }
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetLabels()) ? 131071 : 524287); if (isSetLabels()) hashCode = hashCode * 8191 + labels.hashCode(); return hashCode; }
@org.apache.thrift.annotation.Nullable public java.lang.Object getFieldValue(_Fields field) { switch (field) { case LABELS: return getLabels(); } throw new java.lang.IllegalStateException(); }
public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity if (timeRange != null) { timeRange.validate(); } if (authorizations != null) { authorizations.validate(); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TAuthorization struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.labels = new java.util.ArrayList<java.lang.String>(_list13.size); @org.apache.thrift.annotation.Nullable java.lang.String _elem14; for (int _i15 = 0; _i15 < _list13.size; ++_i15) { _elem14 = iprot.readString(); struct.labels.add(_elem14); } } struct.setLabelsIsSet(true); } } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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); } }
@Test public void testIncrementWithTagsWithNotMatchLabels() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testIncrementWithTagsWithNotMatchLabels"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValues = new ArrayList<>(1); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(Bytes.toBytes(1L)))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE)); handler.put(table, put); List<TColumnIncrement> incrementColumns = new ArrayList<>(1); incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); TIncrement increment = new TIncrement(wrap(rowName), incrementColumns); increment.setCellVisibility(new TCellVisibility().setExpression(SECRET)); handler.increment(table, increment); TGet get = new TGet(wrap(rowName)); TAuthorization tauth = new TAuthorization(); List<String> labels = new ArrayList<>(1); labels.add(PUBLIC); tauth.setLabels(labels); get.setAuthorizations(tauth); TResult result = handler.get(table, get); assertNull(result.getRow()); }
case 8: // AUTHORIZATIONS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.authorizations = new TAuthorization(); struct.authorizations.read(iprot); struct.setAuthorizationsIsSet(true); } else {
struct.setLabelsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
if (struct.isSetAuthorizations()) { oprot.writeFieldBegin(AUTHORIZATIONS_FIELD_DESC); struct.authorizations.write(oprot); oprot.writeFieldEnd();
/** * Performs a deep copy on <i>other</i>. */ public TAuthorization(TAuthorization other) { if (other.isSetLabels()) { java.util.List<java.lang.String> __this__labels = new java.util.ArrayList<java.lang.String>(other.labels); this.labels = __this__labels; } }
public void write(org.apache.thrift.protocol.TProtocol oprot, TAuthorization struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.labels != null) { if (struct.isSetLabels()) { oprot.writeFieldBegin(LABELS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.labels.size())); for (String _iter11 : struct.labels) { oprot.writeString(_iter11); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public Object getFieldValue(_Fields field) { switch (field) { case LABELS: return getLabels(); } throw new IllegalStateException(); }