Search in sources :

Example 1 with ExportConfiguration

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);
}
Also used : ExportForms(org.opendatakit.briefcase.export.ExportForms) ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) ConfigurationPanel(org.opendatakit.briefcase.ui.export.components.ConfigurationPanel)

Example 2 with ExportConfiguration

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();
}
Also used : ConfigurationPanel(org.opendatakit.briefcase.ui.export.components.ConfigurationPanel) TransferSucceededEvent(org.opendatakit.briefcase.model.TransferSucceededEvent) ExportProgressEvent(org.opendatakit.briefcase.model.ExportProgressEvent) LocalDateTime(java.time.LocalDateTime) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) EXPORT(org.opendatakit.briefcase.model.FormStatus.TransferType.EXPORT) ExportFailedEvent(org.opendatakit.briefcase.model.ExportFailedEvent) BriefcaseFormDefinition(org.opendatakit.briefcase.model.BriefcaseFormDefinition) AnnotationProcessor(org.bushe.swing.event.annotation.AnnotationProcessor) ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) ISO_DATE_TIME(java.time.format.DateTimeFormatter.ISO_DATE_TIME) SavePasswordsConsentRevoked(org.opendatakit.briefcase.model.SavePasswordsConsentRevoked) ExportForms(org.opendatakit.briefcase.export.ExportForms) ExportSucceededWithErrorsEvent(org.opendatakit.briefcase.model.ExportSucceededWithErrorsEvent) FileSystemUtils(org.opendatakit.briefcase.util.FileSystemUtils) ExportSucceededEvent(org.opendatakit.briefcase.model.ExportSucceededEvent) ExportForms.buildCustomConfPrefix(org.opendatakit.briefcase.export.ExportForms.buildCustomConfPrefix) FormStatus(org.opendatakit.briefcase.model.FormStatus) FormStatusEvent(org.opendatakit.briefcase.model.FormStatusEvent) Executor(java.util.concurrent.Executor) ExportAction(org.opendatakit.briefcase.export.ExportAction) SavePasswordsConsentGiven(org.opendatakit.briefcase.model.SavePasswordsConsentGiven) Collectors.joining(java.util.stream.Collectors.joining) NewTransferAction(org.opendatakit.briefcase.transfer.NewTransferAction) TerminationFuture(org.opendatakit.briefcase.model.TerminationFuture) Collectors.toList(java.util.stream.Collectors.toList) ODKOptionPane.showErrorDialog(org.opendatakit.briefcase.ui.ODKOptionPane.showErrorDialog) List(java.util.List) Stream(java.util.stream.Stream) EventSubscriber(org.bushe.swing.event.annotation.EventSubscriber) Analytics(org.opendatakit.briefcase.ui.reused.Analytics) Collections(java.util.Collections) ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration)

Example 3 with ExportConfiguration

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));
}
Also used : ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) Test(org.junit.Test)

Example 4 with ExportConfiguration

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()));
}
Also used : ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) Test(org.junit.Test)

Example 5 with ExportConfiguration

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());
}
Also used : ExportConfiguration(org.opendatakit.briefcase.export.ExportConfiguration) Test(org.junit.Test)

Aggregations

ExportConfiguration (org.opendatakit.briefcase.export.ExportConfiguration)7 Test (org.junit.Test)5 ExportForms (org.opendatakit.briefcase.export.ExportForms)3 ConfigurationPanel (org.opendatakit.briefcase.ui.export.components.ConfigurationPanel)3 BriefcasePreferences (org.opendatakit.briefcase.model.BriefcasePreferences)2 FormStatus (org.opendatakit.briefcase.model.FormStatus)2 TerminationFuture (org.opendatakit.briefcase.model.TerminationFuture)2 LocalDateTime (java.time.LocalDateTime)1 ISO_DATE_TIME (java.time.format.DateTimeFormatter.ISO_DATE_TIME)1 Collections (java.util.Collections)1 List (java.util.List)1 Executor (java.util.concurrent.Executor)1 Collectors.joining (java.util.stream.Collectors.joining)1 Collectors.toList (java.util.stream.Collectors.toList)1 Stream (java.util.stream.Stream)1 AnnotationProcessor (org.bushe.swing.event.annotation.AnnotationProcessor)1 EventSubscriber (org.bushe.swing.event.annotation.EventSubscriber)1 ExportAction (org.opendatakit.briefcase.export.ExportAction)1 ExportForms.buildCustomConfPrefix (org.opendatakit.briefcase.export.ExportForms.buildCustomConfPrefix)1 BriefcaseFormDefinition (org.opendatakit.briefcase.model.BriefcaseFormDefinition)1