class ThemisCpUtil {

  public static Scan constructLockAndWriteScan(Scan userScan, long startTs) throws IOException {
    boolean excludeDataColumn = false;
    Scan internalScan = new Scan(userScan);
    internalScan.setFilter(null);
    internalScan.setFamilyMap(new TreeMap<byte[], NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR));
    for (Entry<byte[], NavigableSet<byte[]>> entry : userScan.getFamilyMap().entrySet()) {
      if (entry.getValue() != null && entry.getValue().size() > 0) {
        for (byte[] qualifier : entry.getValue()) {
          Column dataColumn = new Column(entry.getKey(), qualifier);
          addLockAndWriteColumnToScan(dataColumn, internalScan);
        }
      } else {
        // TODO : use filter to read out lock columns corresponding to needed data column
        internalScan.addFamily(ColumnUtil.LOCK_FAMILY_NAME);
        internalScan.addFamily(entry.getKey());
        if (!ColumnUtil.isCommitToSameFamily()) {
          internalScan.addFamily(ColumnUtil.PUT_FAMILY_NAME_BYTES);
          internalScan.addFamily(ColumnUtil.DELETE_FAMILY_NAME_BYTES);
        }
        excludeDataColumn = true;
      }
    }
    if (excludeDataColumn) {
      internalScan.setFilter(new ExcludeDataColumnFilter());
    }
    internalScan.setTimeRange(0, startTs);
    moveRowkeyFiltersForWriteScan(userScan, internalScan);
    return internalScan;
  }

}