use of org.apache.hadoop.hbase.security.visibility.CellVisibility in project hbase by apache.
the class ThriftUtilities method putFromHBase.
public static TPut putFromHBase(Put in) {
TPut out = new TPut();
out.setRow(in.getRow());
if (in.getTimestamp() != HConstants.LATEST_TIMESTAMP) {
out.setTimestamp(in.getTimestamp());
}
if (in.getDurability() != Durability.USE_DEFAULT) {
out.setDurability(durabilityFromHBase(in.getDurability()));
}
for (Map.Entry<byte[], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
byte[] family = entry.getKey();
for (Cell cell : entry.getValue()) {
TColumnValue columnValue = new TColumnValue();
columnValue.setFamily(family).setQualifier(CellUtil.cloneQualifier(cell)).setType(cell.getType().getCode()).setTimestamp(cell.getTimestamp()).setValue(CellUtil.cloneValue(cell));
if (cell.getTagsLength() != 0) {
columnValue.setTags(PrivateCellUtil.cloneTags(cell));
}
out.addToColumnValues(columnValue);
}
}
for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())), ByteBuffer.wrap(attribute.getValue()));
}
try {
CellVisibility cellVisibility = in.getCellVisibility();
if (cellVisibility != null) {
TCellVisibility tCellVisibility = new TCellVisibility();
tCellVisibility.setExpression(cellVisibility.getExpression());
out.setCellVisibility(tCellVisibility);
}
} catch (DeserializationException e) {
throw new RuntimeException(e);
}
return out;
}
use of org.apache.hadoop.hbase.security.visibility.CellVisibility in project hbase by apache.
the class ThriftUtilities method incrementFromHBase.
public static TIncrement incrementFromHBase(Increment in) throws IOException {
TIncrement out = new TIncrement();
out.setRow(in.getRow());
if (in.getDurability() != Durability.USE_DEFAULT) {
out.setDurability(durabilityFromHBase(in.getDurability()));
}
for (Map.Entry<byte[], List<Cell>> entry : in.getFamilyCellMap().entrySet()) {
byte[] family = entry.getKey();
for (Cell cell : entry.getValue()) {
TColumnIncrement columnValue = new TColumnIncrement();
columnValue.setFamily(family).setQualifier(CellUtil.cloneQualifier(cell));
columnValue.setAmount(Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
out.addToColumns(columnValue);
}
}
for (Map.Entry<String, byte[]> attribute : in.getAttributesMap().entrySet()) {
out.putToAttributes(ByteBuffer.wrap(Bytes.toBytes(attribute.getKey())), ByteBuffer.wrap(attribute.getValue()));
}
try {
CellVisibility cellVisibility = in.getCellVisibility();
if (cellVisibility != null) {
TCellVisibility tCellVisibility = new TCellVisibility();
tCellVisibility.setExpression(cellVisibility.getExpression());
out.setCellVisibility(tCellVisibility);
}
} catch (DeserializationException e) {
throw new RuntimeException(e);
}
out.setReturnResults(in.isReturnResults());
return out;
}
Aggregations