use of org.opendatakit.briefcase.export.ExportConfiguration in project briefcase by opendatakit.
the class ExportPanel method from.
public static ExportPanel from(TerminationFuture terminationFuture, BriefcasePreferences exportPreferences, BriefcasePreferences appPreferences, Executor backgroundExecutor, Analytics analytics) {
ExportConfiguration defaultConfiguration = ExportConfiguration.load(exportPreferences);
ConfigurationPanel confPanel = ConfigurationPanel.defaultPanel(defaultConfiguration, BriefcasePreferences.getStorePasswordsConsentProperty(), true);
ExportForms forms = ExportForms.load(defaultConfiguration, getFormsFromStorage(), exportPreferences, appPreferences);
ExportPanelForm form = ExportPanelForm.from(forms, confPanel);
return new ExportPanel(terminationFuture, forms, form, exportPreferences, backgroundExecutor, analytics);
}
use of org.opendatakit.briefcase.export.ExportConfiguration in project briefcase by opendatakit.
the class ExportPanel method export.
private void export() {
form.disableUI();
terminationFuture.reset();
forms.getSelectedForms().parallelStream().peek(FormStatus::clearStatusHistory).forEach(form -> {
String formId = form.getFormDefinition().getFormId();
ExportConfiguration configuration = forms.getConfiguration(formId);
if (configuration.resolvePullBefore())
forms.getTransferSettings(formId).ifPresent(sci -> NewTransferAction.transferServerToBriefcase(sci, terminationFuture, Collections.singletonList(form)));
ExportAction.export((BriefcaseFormDefinition) form.getFormDefinition(), configuration, terminationFuture);
});
form.enableUI();
}
use of org.opendatakit.briefcase.export.ExportConfiguration in project briefcase by opendatakit.
the class ConfigurationPanelTest method override_panel_loads_values_from_the_initial_configuration.
@Test
public void override_panel_loads_values_from_the_initial_configuration() {
ExportConfiguration expectedConfiguration = ExportConfiguration.empty();
expectedConfiguration.setExportDir(Paths.get("/some/path"));
expectedConfiguration.setPemFile(Paths.get("/some/file.pem"));
expectedConfiguration.setStartDate(LocalDate.of(2018, 1, 1));
expectedConfiguration.setEndDate(LocalDate.of(2019, 1, 1));
expectedConfiguration.setPullBeforeOverride(PULL);
component = ConfigurationPanelPageObject.setUpOverridePanel(robot(), expectedConfiguration, true, true);
component.show();
assertThat(component.exportDirField(), containsText(expectedConfiguration.getExportDir().get().toString()));
assertThat(component.pemFileField(), containsText(expectedConfiguration.getPemFile().get().toString()));
assertThat(component.startDateField().getDate(), is(expectedConfiguration.getStartDate().get()));
assertThat(component.endDateField().getDate(), is(expectedConfiguration.getEndDate().get()));
assertThat(component.pullBeforeOverrideField(), hasSelectedItem(PULL));
}
use of org.opendatakit.briefcase.export.ExportConfiguration in project briefcase by opendatakit.
the class ConfigurationPanelTest method default_panel_loads_values_from_the_initial_configuration.
@Test
public void default_panel_loads_values_from_the_initial_configuration() {
ExportConfiguration expectedConfiguration = ExportConfiguration.empty();
expectedConfiguration.setExportDir(Paths.get("/some/path"));
expectedConfiguration.setPemFile(Paths.get("/some/file.pem"));
expectedConfiguration.setStartDate(LocalDate.of(2018, 1, 1));
expectedConfiguration.setEndDate(LocalDate.of(2019, 1, 1));
expectedConfiguration.setPullBefore(true);
component = ConfigurationPanelPageObject.setUpDefaultPanel(robot(), expectedConfiguration, true, true);
component.show();
assertThat(component.exportDirField(), containsText(expectedConfiguration.getExportDir().get().toString()));
assertThat(component.pemFileField(), containsText(expectedConfiguration.getPemFile().get().toString()));
assertThat(component.startDateField().getDate(), is(expectedConfiguration.getStartDate().get()));
assertThat(component.endDateField().getDate(), is(expectedConfiguration.getEndDate().get()));
assertThat(component.pullBeforeField(), is(selected()));
}
use of org.opendatakit.briefcase.export.ExportConfiguration in project briefcase by opendatakit.
the class ConfigurationPanelTest method override_panel_wires_UI_fields_to_the_model.
@Test
public void override_panel_wires_UI_fields_to_the_model() {
component = ConfigurationPanelPageObject.setUpOverridePanel(robot(), ExportConfiguration.empty(), true, true);
component.show();
component.setSomePemFile();
component.setSomeExportDir();
component.setSomeStartDate();
component.setSomeEndDate();
component.setPullBeforeOverride(PULL);
ExportConfiguration conf = component.getConfiguration();
assertThat(conf.getExportDir(), isPresent());
assertThat(conf.getPemFile(), isPresent());
assertThat(conf.getStartDate(), isPresent());
assertThat(conf.getEndDate(), isPresent());
assertThat(conf.getPullBeforeOverride(), isPresent());
}
Aggregations