class ScanMappingToScanConfigTransformer {

    public ScanConfig transform(List<ScanMapping> mappings) {
        ScanConfig config = new ScanConfig();
        
        if (mappings==null || mappings.size()==0) {
            return config;
        }
        
        for (ScanMapping mapping: mappings) {
            MappingData data = MappingData.fromString(mapping.getData());
            config.getNamePatternMappings().put(mapping.getId(), convert(data));
        }
        
        return config;
    }

}