class ThemisCpUtil {

  public static void addLockAndWriteColumnToScan(Column column, Scan scan) {
    // avoid overwrite the whole lock family
    if (!(scan.getFamilyMap().containsKey(ColumnUtil.LOCK_FAMILY_NAME) && scan
        .getFamilyMap().get(ColumnUtil.LOCK_FAMILY_NAME) == null)) {
      Column lockColumn = ColumnUtil.getLockColumn(column);
      scan.addColumn(lockColumn.getFamily(), lockColumn.getQualifier());
    }
    Column putColumn = ColumnUtil.getPutColumn(column);
    if (ColumnUtil.isCommitToSameFamily()
        || !(scan.getFamilyMap().containsKey(ColumnUtil.PUT_FAMILY_NAME_BYTES) && scan
            .getFamilyMap().get(ColumnUtil.PUT_FAMILY_NAME_BYTES) == null)) {
      scan.addColumn(putColumn.getFamily(), putColumn.getQualifier());
    }
    Column deleteColumn = ColumnUtil.getDeleteColumn(column);
    if (ColumnUtil.isCommitToSameFamily()
        || !(scan.getFamilyMap().containsKey(ColumnUtil.DELETE_FAMILY_NAME_BYTES) && scan
            .getFamilyMap().get(ColumnUtil.DELETE_FAMILY_NAME_BYTES) == null)) {
      scan.addColumn(deleteColumn.getFamily(), deleteColumn.getQualifier());
    }
  }

}