public static TAppend appendFromHBase(Append in) throws IOException { TAppend out = new TAppend(); out.setRow(in.getRow()); out.setDurability(durabilityFromHBase(in.getDurability())); columnValue.setTags(CellUtil.cloneTags(cell)); out.addToColumns(columnValue); out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())), ByteBuffer.wrap(attribute.getValue())); TCellVisibility tCellVisibility = new TCellVisibility(); tCellVisibility.setExpression(cellVisibility.getExpression()); out.setCellVisibility(tCellVisibility); out.setReturnResults(in.isReturnResults()); return out;
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TAppend) return this.equals((TAppend)that); return false; }
@org.apache.thrift.annotation.Nullable public java.lang.Object getFieldValue(_Fields field) { switch (field) { case ROW: return getRow(); case COLUMNS: return getColumns(); case ATTRIBUTES: return getAttributes(); case DURABILITY: return getDurability(); case CELL_VISIBILITY: return getCellVisibility(); case RETURN_RESULTS: return isReturnResults(); } throw new java.lang.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 java.lang.IllegalArgumentException(); } switch (field) { case ROW: return isSetRow(); case COLUMNS: return isSetColumns(); case ATTRIBUTES: return isSetAttributes(); case DURABILITY: return isSetDurability(); case CELL_VISIBILITY: return isSetCellVisibility(); case RETURN_RESULTS: return isSetReturnResults(); } throw new java.lang.IllegalStateException(); }
case ROW: if (value == null) { unsetRow(); } else { if (value instanceof byte[]) { setRow((byte[])value); } else { setRow((java.nio.ByteBuffer)value); unsetColumns(); } else { setColumns((java.util.List<TColumnValue>)value); unsetAttributes(); } else { setAttributes((java.util.Map<java.nio.ByteBuffer,java.nio.ByteBuffer>)value); unsetDurability(); } else { setDurability((TDurability)value); unsetCellVisibility(); } else { setCellVisibility((TCellVisibility)value); unsetReturnResults(); } else { setReturnResults((java.lang.Boolean)value);
if (isSetAttributes()) { if (!first) sb.append(", "); sb.append("attributes:"); if (isSetDurability()) { if (!first) sb.append(", "); sb.append("durability:"); if (isSetCellVisibility()) { if (!first) sb.append(", "); sb.append("cellVisibility:"); if (isSetReturnResults()) { if (!first) sb.append(", "); sb.append("returnResults:");
public static Append appendFromThrift(TAppend append) throws IOException { Append out = new Append(append.getRow()); for (TColumnValue column : append.getColumns()) { out.addColumn(column.getFamily(), column.getQualifier(), column.getValue()); } if (append.isSetAttributes()) { addAttributes(out, append.getAttributes()); } if (append.isSetDurability()) { out.setDurability(durabilityFromThrift(append.getDurability())); } if(append.getCellVisibility() != null) { out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression())); } if (append.isSetReturnResults()) { out.setReturnResults(append.isReturnResults()); } return out; }
public static Append appendFromThrift(TAppend append) throws IOException { Append out = new Append(append.getRow()); for (TColumnValue column : append.getColumns()) { out.addColumn(column.getFamily(), column.getQualifier(), column.getValue()); } if (append.isSetAttributes()) { addAttributes(out, append.getAttributes()); } if (append.isSetDurability()) { out.setDurability(durabilityFromThrift(append.getDurability())); } if(append.getCellVisibility() != null) { out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression())); } return out; }
if (isSetAttributes()) { if (!first) sb.append(", "); sb.append("attributes:"); if (isSetDurability()) { if (!first) sb.append(", "); sb.append("durability:"); if (isSetCellVisibility()) { if (!first) sb.append(", "); sb.append("cellVisibility:");
@Override public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.append = new TAppend(); struct.append.read(iprot); struct.setAppendIsSet(true); } }
public TAppend deepCopy() { return new TAppend(this); }
appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v2))); TAppend append = new TAppend(wrap(rowName), appendColumns); append.setCellVisibility(new TCellVisibility().setExpression(SECRET)); handler.append(table, append);
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetRow()) ? 131071 : 524287); if (isSetRow()) hashCode = hashCode * 8191 + row.hashCode(); hashCode = hashCode * 8191 + ((isSetColumns()) ? 131071 : 524287); if (isSetColumns()) hashCode = hashCode * 8191 + columns.hashCode(); hashCode = hashCode * 8191 + ((isSetAttributes()) ? 131071 : 524287); if (isSetAttributes()) hashCode = hashCode * 8191 + attributes.hashCode(); hashCode = hashCode * 8191 + ((isSetDurability()) ? 131071 : 524287); if (isSetDurability()) hashCode = hashCode * 8191 + durability.getValue(); hashCode = hashCode * 8191 + ((isSetCellVisibility()) ? 131071 : 524287); if (isSetCellVisibility()) hashCode = hashCode * 8191 + cellVisibility.hashCode(); hashCode = hashCode * 8191 + ((isSetReturnResults()) ? 131071 : 524287); if (isSetReturnResults()) hashCode = hashCode * 8191 + ((returnResults) ? 131071 : 524287); return hashCode; }
case ROW: if (value == null) { unsetRow(); } else { setRow((ByteBuffer)value); unsetColumns(); } else { setColumns((List<TColumnValue>)value); unsetAttributes(); } else { setAttributes((Map<ByteBuffer,ByteBuffer>)value); unsetDurability(); } else { setDurability((TDurability)value); unsetCellVisibility(); } else { setCellVisibility((TCellVisibility)value);
if (struct.isSetAttributes()) { optionals.set(0); if (struct.isSetDurability()) { optionals.set(1); if (struct.isSetCellVisibility()) { optionals.set(2); if (struct.isSetReturnResults()) { optionals.set(3); if (struct.isSetAttributes()) { if (struct.isSetDurability()) { oprot.writeI32(struct.durability.getValue()); if (struct.isSetCellVisibility()) { struct.cellVisibility.write(oprot); if (struct.isSetReturnResults()) { oprot.writeBool(struct.returnResults);
public static Append appendFromThrift(TAppend append) throws IOException { Append out = new Append(append.getRow()); for (TColumnValue column : append.getColumns()) { out.addColumn(column.getFamily(), column.getQualifier(), column.getValue()); } if (append.isSetAttributes()) { addAttributes(out, append.getAttributes()); } if (append.isSetDurability()) { out.setDurability(durabilityFromThrift(append.getDurability())); } if(append.getCellVisibility() != null) { out.setCellVisibility(new CellVisibility(append.getCellVisibility().getExpression())); } return out; }
if (isSetAttributes()) { if (!first) sb.append(", "); sb.append("attributes:"); if (isSetDurability()) { if (!first) sb.append(", "); sb.append("durability:"); if (isSetCellVisibility()) { if (!first) sb.append(", "); sb.append("cellVisibility:");
@Override public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.append = new TAppend(); struct.append.read(iprot); struct.setAppendIsSet(true); } }
@Test public void testAppendWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testAppend"); ByteBuffer table = wrap(tableAname); byte[] v1 = Bytes.toBytes("42"); List<TColumnValue> appendColumns = new ArrayList<>(1); appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v1))); TAppend append = new TAppend(wrap(rowName), appendColumns); boolean exceptionCaught = false; try { handler.append(table, append); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
appendColumns.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(v2))); TAppend append = new TAppend(wrap(rowName), appendColumns); append.setCellVisibility(new TCellVisibility().setExpression(SECRET)); handler.append(table, append);