Source:
<code>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)); <START> if (((BriefcaseFormDefinition) form.getFormDefinition()).isFileEncryptedForm() || <END> ((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 ); }</code><technical_language>This happen ExportConfiguration.load(). Also, depend of saved formNeedsPrivateKey preference. place instantiating ExportConfiguration saved preferences is ExportConfiguration.load() method. If is formNeedsPrivateKey pref, Optional.empty(). If is a formNeedsPrivateKey pref, Optional<Boolean> saved</technical_language>

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 ); }