class ModelKeyParser {

    public static Key createKey(FieldMapping mapping, String modelName) {
        ColumnVisibility cv = new ColumnVisibility(mapping.getColumnVisibility());
        
        String inName = Direction.REVERSE.equals(mapping.getDirection()) ? mapping.getFieldName() : mapping.getModelFieldName();
        String outName = Direction.REVERSE.equals(mapping.getDirection()) ? mapping.getModelFieldName() : mapping.getFieldName();
        String dataType = StringUtils.isEmpty(mapping.getDatatype()) ? "" : NULL_BYTE + mapping.getDatatype().trim();
        return new Key(inName, // Row
                        modelName + dataType, // ColFam
                        outName + NULL_BYTE + mapping.getDirection().getValue(), // ColQual
                        cv, // Visibility
                        System.currentTimeMillis() // Timestamp
        );
    }

}