* @return A List of column id:s
*/
public static List<Integer> getColumnIds( String columnNames, Map<String, Integer> allColumns,
Map<String, Integer> deprecatedColumns, Log log )
{
DualHashBidiMap bidiColumns = null;
List<Integer> columnIds = new ArrayList<Integer>();
String[] columnNamesArray = columnNames.split( "," );
if ( deprecatedColumns != null )
{
bidiColumns = new DualHashBidiMap( allColumns );
}
// Loop through the names of the columns, to validate each of them and add their id to the list
for ( String aColumnNamesArray : columnNamesArray )
{
String columnName = aColumnNamesArray.trim();
if ( allColumns.containsKey( columnName ) )
{
columnIds.add( allColumns.get( columnName ) );
}
else if ( deprecatedColumns != null && deprecatedColumns.containsKey( columnName ) )
{
Integer columnId = deprecatedColumns.get( columnName );
columnIds.add( columnId );
if ( log != null )
{
log.warn( "The columnName '" + columnName + "' has been deprecated." + " Please use "
+ "the columnName '" + bidiColumns.getKey( columnId ) + "' instead." );
}
}
}
return columnIds;
}