Search in sources :

Example 1 with JobsRunner

use of org.opendatakit.briefcase.reused.job.JobsRunner in project briefcase by opendatakit.

the class Central method push.

@Override
public JobsRunner push(TransferForms forms, Path briefcaseDir) {
    forms.filter(FormStatus::isEncrypted).forEach(form -> form.setStatusString("Skipping. Encrypted forms can't be pushed to ODK Central yet"));
    String token = http.execute(server.getSessionTokenRequest()).orElseThrow(() -> new BriefcaseException("Can't authenticate with ODK Central"));
    PushToCentral pushOp = new PushToCentral(http, server, briefcaseDir, token, EventBus::publish);
    return JobsRunner.launchAsync(forms.filter(f -> !f.isEncrypted()).map(pushOp::push)).onComplete(() -> EventBus.publish(new PushEvent.Complete()));
}
Also used : FileSystemFormMetadataAdapter(org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter) BriefcasePreferences(org.opendatakit.briefcase.model.BriefcasePreferences) PushToCentral(org.opendatakit.briefcase.push.central.PushToCentral) HashSet(java.util.HashSet) FormMetadataPort(org.opendatakit.briefcase.model.form.FormMetadataPort) EventBus(org.bushe.swing.event.EventBus) BriefcaseException(org.opendatakit.briefcase.reused.BriefcaseException) TransferForms(org.opendatakit.briefcase.transfer.TransferForms) CentralServerDialog(org.opendatakit.briefcase.ui.reused.transfer.sourcetarget.CentralServerDialog) Container(java.awt.Container) UI.uncheckedBrowse(org.opendatakit.briefcase.ui.reused.UI.uncheckedBrowse) Path(java.nio.file.Path) FormKey(org.opendatakit.briefcase.model.form.FormKey) FormMetadataQueries.submissionVersionsOf(org.opendatakit.briefcase.model.form.FormMetadataQueries.submissionVersionsOf) Test(org.opendatakit.briefcase.reused.transfer.RemoteServer.Test) FormStatus(org.opendatakit.briefcase.model.FormStatus) CentralServer(org.opendatakit.briefcase.reused.transfer.CentralServer) JobsRunner(org.opendatakit.briefcase.reused.job.JobsRunner) Set(java.util.Set) Http(org.opendatakit.briefcase.reused.http.Http) Consumer(java.util.function.Consumer) PushEvent(org.opendatakit.briefcase.push.PushEvent) JLabel(javax.swing.JLabel) UI.makeClickable(org.opendatakit.briefcase.ui.reused.UI.makeClickable) Optional(java.util.Optional) BriefcaseException(org.opendatakit.briefcase.reused.BriefcaseException) PushToCentral(org.opendatakit.briefcase.push.central.PushToCentral) EventBus(org.bushe.swing.event.EventBus)

Aggregations

Container (java.awt.Container)1 Path (java.nio.file.Path)1 HashSet (java.util.HashSet)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Consumer (java.util.function.Consumer)1 JLabel (javax.swing.JLabel)1 EventBus (org.bushe.swing.event.EventBus)1 BriefcasePreferences (org.opendatakit.briefcase.model.BriefcasePreferences)1 FormStatus (org.opendatakit.briefcase.model.FormStatus)1 FileSystemFormMetadataAdapter (org.opendatakit.briefcase.model.form.FileSystemFormMetadataAdapter)1 FormKey (org.opendatakit.briefcase.model.form.FormKey)1 FormMetadataPort (org.opendatakit.briefcase.model.form.FormMetadataPort)1 FormMetadataQueries.submissionVersionsOf (org.opendatakit.briefcase.model.form.FormMetadataQueries.submissionVersionsOf)1 PushEvent (org.opendatakit.briefcase.push.PushEvent)1 PushToCentral (org.opendatakit.briefcase.push.central.PushToCentral)1 BriefcaseException (org.opendatakit.briefcase.reused.BriefcaseException)1 Http (org.opendatakit.briefcase.reused.http.Http)1 JobsRunner (org.opendatakit.briefcase.reused.job.JobsRunner)1 CentralServer (org.opendatakit.briefcase.reused.transfer.CentralServer)1