Source:
public static ExportForms load(ExportConfiguration defaultConfiguration, List<FormStatus> forms, BriefcasePreferences exportPreferences, BriefcasePreferences appPreferences) { Map<String, ExportConfiguration> configurations = new HashMap<>(); Map<String, LocalDateTime> lastExportDateTimes = new HashMap<>(); Map<String, ServerConnectionInfo> transferSettings = new HashMap<>(); forms.forEach(form -> { String formId = getFormId(form); ExportConfiguration load = ExportConfiguration.load(exportPreferences, buildCustomConfPrefix(formId)); if (((BriefcaseFormDefinition) form.getFormDefinition()).isFileEncryptedForm() || ((BriefcaseFormDefinition) form.getFormDefinition()).isFieldEncryptedForm()) { load.setFormNeedsPrivateKey(Boolean.TRUE); } if (!load.isEmpty()) { configurations.put(formId, load); } exportPreferences.nullSafeGet(buildExportDateTimePrefix(formId)) .map(LocalDateTime::parse) .ifPresent(dateTime -> lastExportDateTimes.put(formId, dateTime)); String urlKey = String.format("%s_pull_settings_url", formId); String usernameKey = String.format("%s_pull_settings_username", formId); String passwordKey = String.format("%s_pull_settings_password", formId); if (appPreferences.hasKey(urlKey) && appPreferences.hasKey(usernameKey) && appPreferences.hasKey(passwordKey)) transferSettings.put(formId, new ServerConnectionInfo( appPreferences.nullSafeGet(urlKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + urlKey)), appPreferences.nullSafeGet(usernameKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + usernameKey)), appPreferences.nullSafeGet(passwordKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + passwordKey)).toCharArray() )); }); return new ExportForms( forms, defaultConfiguration, configurations, lastExportDateTimes, transferSettings ); }

Target:
public static ExportForms load(ExportConfiguration defaultConfiguration, List<FormStatus> forms, BriefcasePreferences exportPreferences, BriefcasePreferences appPreferences) { Map<String, ExportConfiguration> configurations = new HashMap<>(); Map<String, LocalDateTime> lastExportDateTimes = new HashMap<>(); Map<String, ServerConnectionInfo> transferSettings = new HashMap<>(); forms.forEach(form -> { String formId = getFormId(form); ExportConfiguration load = ExportConfiguration.loadFormConfig(exportPreferences, buildCustomConfPrefix(formId)); if (!load.isEmpty()) { configurations.put(formId, load); } exportPreferences.nullSafeGet(buildExportDateTimePrefix(formId)) .map(LocalDateTime::parse) .ifPresent(dateTime -> lastExportDateTimes.put(formId, dateTime)); String urlKey = String.format("%s_pull_settings_url", formId); String usernameKey = String.format("%s_pull_settings_username", formId); String passwordKey = String.format("%s_pull_settings_password", formId); if (appPreferences.hasKey(urlKey) && appPreferences.hasKey(usernameKey) && appPreferences.hasKey(passwordKey)) transferSettings.put(formId, new ServerConnectionInfo( appPreferences.nullSafeGet(urlKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + urlKey)), appPreferences.nullSafeGet(usernameKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + usernameKey)), appPreferences.nullSafeGet(passwordKey) .orElseThrow(() -> new RuntimeException("Null value saved for " + passwordKey)).toCharArray() )); }); return new ExportForms( forms, defaultConfiguration, configurations, lastExportDateTimes, transferSettings ); }