public I_CmsExtractionResult merge(List<I_CmsExtractionResult> extractionResults) {
Map<Locale, LinkedHashMap<String, String>> contentItems = new HashMap<Locale, LinkedHashMap<String, String>>(
m_locales.size());
for (Locale locale : m_locales) {
LinkedHashMap<String, String> originalLocalValues = m_contentItems.get(locale);
LinkedHashMap<String, String> localeValues = new LinkedHashMap<String, String>(originalLocalValues);
contentItems.put(locale, localeValues);
}
HashMap<String, String> fieldMappings = new HashMap<String, String>(m_fieldMappings.size());
for (String fieldMapping : m_fieldMappings.keySet()) {
fieldMappings.put(fieldMapping, m_fieldMappings.get(fieldMapping));
}
for (Locale locale : m_locales) {
Map<String, String> localeValues = contentItems.get(locale);
for (I_CmsExtractionResult result : extractionResults) {
if (result.getLocales().contains(locale)) {
Map<String, String> resultLocaleValues = result.getContentItems(locale);
for (String item : Arrays.asList(ITEMS_TO_MERGE)) {
localeValues = mergeItem(item, localeValues, resultLocaleValues);
}
}
}
}
return new CmsExtractionResult(m_defaultLocale, contentItems, fieldMappings);
}