public void translateFromColumn(Row row, TypedRow entity) {
String columnName = getColumnName();
byte[] namePrefix = StandardConverters.convertToBytes(columnName);
Collection<Column> columns = row.columnByPrefix(namePrefix);
if (columns != null && !columns.isEmpty()) {
Column column = columns.iterator().next();
byte[] value = column.getValue();
byte[] fullName = column.getName();
//strip off the prefix to get the foreign key
int pkLen = fullName.length-namePrefix.length;
byte[] fk = new byte[pkLen];
for(int i = namePrefix.length; i < fullName.length; i++) {
fk[i-namePrefix.length] = fullName[i];
}
entity.addColumn(this, fullName, namePrefix, fk, value, column.getTimestamp());
}
else {
//Check if the column exists in old way
Column column = row.getColumn(getColumnNameAsBytes());
if(column == null)
return;
byte[] value = column.getValue();
entity.addColumn(this, getColumnNameAsBytes(), value, column.getTimestamp());
}
}