-
Notifications
You must be signed in to change notification settings - Fork 153
Clean up unused members and functions #745
Changes from all commits
13be3bc
93b8e0a
70948a4
a41e422
a1a4f83
dbdb68a
c88c3f5
71d69f0
5d51e24
ae3fbf9
26bfa14
213b1b5
c0844a4
42b6892
de61672
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ | |
import java.util.Optional; | ||
import java.util.function.BiConsumer; | ||
import org.opendatakit.briefcase.model.FormStatus; | ||
import org.opendatakit.briefcase.model.ServerConnectionInfo; | ||
import org.opendatakit.briefcase.pull.aggregate.Cursor; | ||
import org.opendatakit.briefcase.reused.transfer.RemoteServer; | ||
|
||
|
@@ -61,16 +60,6 @@ public Cancel(String cause) { | |
} | ||
} | ||
|
||
public static class NewForm extends PullEvent { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
public final FormStatus form; | ||
public final Optional<ServerConnectionInfo> transferSettings; | ||
|
||
public NewForm(FormStatus form, ServerConnectionInfo transferSettings) { | ||
this.form = form; | ||
this.transferSettings = Optional.ofNullable(transferSettings); | ||
} | ||
} | ||
|
||
public static class CleanAllResumePoints extends PullEvent { | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,11 +52,8 @@ | |
import org.opendatakit.briefcase.reused.job.Job; | ||
import org.opendatakit.briefcase.reused.job.RunnerStatus; | ||
import org.opendatakit.briefcase.reused.transfer.AggregateServer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class PullFromAggregate { | ||
public static final Logger log = LoggerFactory.getLogger(PullFromAggregate.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
private final Http http; | ||
private final AggregateServer server; | ||
private final BriefcasePreferences prefs; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,11 +39,8 @@ | |
import org.opendatakit.briefcase.reused.job.RunnerStatus; | ||
import org.opendatakit.briefcase.reused.transfer.CentralAttachment; | ||
import org.opendatakit.briefcase.reused.transfer.CentralServer; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class PullFromCentral { | ||
public static final Logger log = LoggerFactory.getLogger(PullFromCentral.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
private final Http http; | ||
private final CentralServer server; | ||
private final Path briefcaseDir; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ | |
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStreamWriter; | ||
import java.io.UncheckedIOException; | ||
import java.math.BigInteger; | ||
import java.net.URI; | ||
|
@@ -58,14 +57,6 @@ public class UncheckedFiles { | |
"contents unless explicitly directed to do so.\n"; | ||
private static final Logger log = LoggerFactory.getLogger(UncheckedFiles.class); | ||
|
||
public static Path createTempFile(String prefix, String suffix, FileAttribute<?>... attrs) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Probably only (was) used in tests |
||
try { | ||
return Files.createTempFile(prefix, suffix, attrs); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public static Path write(Path path, List<String> lines, OpenOption... options) { | ||
return write(path, lines.stream(), options); | ||
} | ||
|
@@ -136,14 +127,6 @@ public static Stream<Path> walk(Path path, FileVisitOption... options) { | |
} | ||
} | ||
|
||
public static Path createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Probably only (was) used in tests |
||
try { | ||
return Files.createTempDirectory(dir, prefix, attrs); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public static Path createTempDirectory(String prefix, FileAttribute<?>... attrs) { | ||
try { | ||
return Files.createTempDirectory(prefix, attrs); | ||
|
@@ -288,23 +271,6 @@ public static URI toURI(URL url) { | |
} | ||
} | ||
|
||
public static void append(String content, OutputStreamWriter outputStreamWriter) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Probably only (were) used in tests |
||
try { | ||
outputStreamWriter.append(content); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public static void close(OutputStreamWriter osw) { | ||
try { | ||
osw.flush(); | ||
osw.close(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
public static Stream<Path> list(Path dir) { | ||
try { | ||
return Files.list(dir); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
package org.opendatakit.briefcase.reused.http; | ||
|
||
import org.opendatakit.briefcase.reused.BriefcaseException; | ||
import org.opendatakit.briefcase.reused.http.response.Response; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
public class HttpException extends BriefcaseException { | ||
|
||
|
@@ -28,12 +27,4 @@ public HttpException(String message) { | |
public HttpException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public HttpException(Response<?> response) { | ||
super("HTTP Response status code " + response.getStatusCode()); | ||
} | ||
|
||
public HttpException(Response<?> response, Throwable cause) { | ||
super("HTTP Response status code " + response.getStatusCode(), cause); | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,6 @@ public static JobsRunner launchAsync(Stream<Job<?>> jobs, Consumer<Throwable> on | |
return new JobsRunner(executor); | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
/** | ||
* Run the provided job asynchronously and return an instance that | ||
* will let the caller cancel the background process. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ | |
import static org.opendatakit.briefcase.reused.UncheckedFiles.newInputStream; | ||
import static org.opendatakit.briefcase.reused.http.RequestBuilder.get; | ||
import static org.opendatakit.briefcase.reused.http.RequestBuilder.head; | ||
import static org.opendatakit.briefcase.reused.http.RequestBuilder.url; | ||
|
||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
@@ -38,7 +37,6 @@ | |
import org.opendatakit.briefcase.model.BriefcasePreferences; | ||
import org.opendatakit.briefcase.model.FormStatus; | ||
import org.opendatakit.briefcase.model.RemoteFormDefinition; | ||
import org.opendatakit.briefcase.model.ServerConnectionInfo; | ||
import org.opendatakit.briefcase.pull.aggregate.Cursor; | ||
import org.opendatakit.briefcase.pull.aggregate.DownloadedSubmission; | ||
import org.opendatakit.briefcase.reused.OptionalProduct; | ||
|
@@ -70,16 +68,6 @@ public static AggregateServer normal(URL baseUrl) { | |
return new AggregateServer(baseUrl, Optional.empty()); | ||
} | ||
|
||
public static AggregateServer from(ServerConnectionInfo sci) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
return new AggregateServer( | ||
url(sci.getUrl()), | ||
OptionalProduct.all( | ||
Optional.ofNullable(sci.getUsername()), | ||
Optional.ofNullable(sci.getPassword()).map(String::new) | ||
).map(Credentials::new) | ||
); | ||
} | ||
|
||
public URL getBaseUrl() { | ||
return baseUrl; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,31 +20,21 @@ | |
|
||
public class ConfigurationPanel { | ||
private final ConfigurationPanelForm form; | ||
private final ConfigurationPanelMode mode; | ||
|
||
private ConfigurationPanel(ExportConfiguration initialConfiguration, ConfigurationPanelForm form, ConfigurationPanelMode mode) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
private ConfigurationPanel(ExportConfiguration initialConfiguration, ConfigurationPanelForm form) { | ||
this.form = form; | ||
this.mode = mode; | ||
|
||
form.initialize(initialConfiguration); | ||
} | ||
|
||
static ConfigurationPanel overridePanel(ExportConfiguration initialConfiguration, boolean savePasswordsConsent, boolean hasTransferSettings) { | ||
ConfigurationPanelMode mode = ConfigurationPanelMode.overridePanel(savePasswordsConsent, hasTransferSettings); | ||
return new ConfigurationPanel( | ||
initialConfiguration, | ||
new ConfigurationPanelForm(mode), | ||
mode | ||
); | ||
return new ConfigurationPanel(initialConfiguration, new ConfigurationPanelForm(mode)); | ||
} | ||
|
||
static ConfigurationPanel defaultPanel(ExportConfiguration initialConfiguration, boolean savePasswordsConsent) { | ||
ConfigurationPanelMode mode = ConfigurationPanelMode.defaultPanel(savePasswordsConsent); | ||
return new ConfigurationPanel( | ||
initialConfiguration, | ||
new ConfigurationPanelForm(mode), | ||
mode | ||
); | ||
return new ConfigurationPanel(initialConfiguration, new ConfigurationPanelForm(mode)); | ||
} | ||
|
||
public ConfigurationPanelForm getForm() { | ||
|
@@ -59,9 +49,4 @@ public void setEnabled(boolean enabled, boolean savePasswordsConsent) { | |
form.setEnabled(enabled); | ||
form.changeMode(savePasswordsConsent); | ||
} | ||
|
||
public boolean isEmpty() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
return form.getConfiguration().isEmpty(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,10 +415,6 @@ private void triggerOnChange() { | |
onChangeCallbacks.forEach(callback -> callback.accept(conf)); | ||
} | ||
|
||
public ExportConfiguration getConfiguration() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Oh gosh, I don't know what I was thinking with this one xD |
||
return null; | ||
} | ||
|
||
void changeMode(boolean savePasswordsConsent) { | ||
mode.setSavePasswordsConsent(savePasswordsConsent); | ||
mode.decorate(this, uiLocked); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,10 +71,6 @@ void decorate(ConfigurationPanelForm form, boolean uiLocked) { | |
form.removeGroupNamesOverrideField.setVisible(isOverridePanel); | ||
} | ||
|
||
boolean isOverridePanel() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
return isOverridePanel; | ||
} | ||
|
||
boolean isExportDirCleanable() { | ||
return isOverridePanel; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ static FileChooser directory(Container parent, Optional<File> initialLocation, P | |
|
||
return isLinux() || isWindows() | ||
? new SwingFileChooser(parent, fileChooser, filter, filterDescription) | ||
: new NativeFileChooser(parent, buildFileDialog(parent, initialLocation, fileChooser), fileChooser, filter, filterDescription); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
: new NativeFileChooser(buildFileDialog(parent, initialLocation, fileChooser), fileChooser, filter, filterDescription); | ||
} | ||
|
||
static FileChooser file(Container parent, Optional<File> initialFile) { | ||
|
@@ -92,7 +92,7 @@ static FileChooser file(Container parent, Optional<File> initialFile, Predicate< | |
|
||
return isLinux() || isWindows() | ||
? new SwingFileChooser(parent, fileChooser, filter, filterDescription) | ||
: new NativeFileChooser(parent, buildFileDialog(parent, initialFile, fileChooser), fileChooser, filter, filterDescription); | ||
: new NativeFileChooser(buildFileDialog(parent, initialFile, fileChooser), fileChooser, filter, filterDescription); | ||
} | ||
|
||
static FileDialog buildFileDialog(Container parent, Optional<File> initialLocation, JFileChooser fileChooser) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
import static javax.swing.JFileChooser.FILES_ONLY; | ||
import static org.opendatakit.briefcase.ui.reused.UI.errorMessage; | ||
|
||
import java.awt.Container; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
import java.awt.FileDialog; | ||
import java.io.File; | ||
import java.nio.file.Files; | ||
|
@@ -29,14 +28,12 @@ | |
import javax.swing.JFileChooser; | ||
|
||
class NativeFileChooser implements FileChooser { | ||
private Container parent; | ||
private final FileDialog fileDialog; | ||
private JFileChooser fileChooser; | ||
private Predicate<File> filter; | ||
private String filterDescription; | ||
|
||
NativeFileChooser(Container parent, FileDialog fileDialog, JFileChooser fileChooser, Predicate<File> filter, String filterDescription) { | ||
this.parent = parent; | ||
NativeFileChooser(FileDialog fileDialog, JFileChooser fileChooser, Predicate<File> filter, String filterDescription) { | ||
this.fileDialog = fileDialog; | ||
this.fileChooser = fileChooser; | ||
this.filter = filter; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,10 +58,6 @@ void addOption(T item) { | |
selectField.addItem(item); | ||
} | ||
|
||
public JPanel getContainer() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
return container; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
Optional<T> getSelectedOption() { | ||
return Optional.ofNullable((T) selectField.getSelectedItem()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,10 +89,6 @@ private void createUIComponents() { | |
// TODO: place custom component creation code here | ||
} | ||
|
||
public JComponent getContainer() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
return container; | ||
} | ||
|
||
@Override | ||
public void setEnabled(boolean enabled) { | ||
super.setEnabled(enabled); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,12 +27,8 @@ | |
import org.opendatakit.briefcase.reused.transfer.CentralServer; | ||
import org.opendatakit.briefcase.transfer.TransferForms; | ||
import org.opendatakit.briefcase.ui.reused.transfer.sourcetarget.SourceOrTarget; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public interface PullSource<T> extends SourceOrTarget<T> { | ||
Logger log = LoggerFactory.getLogger(PullSource.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
static PullSource<AggregateServer> aggregate(Http http, Consumer<PullSource> consumer) { | ||
return new Aggregate(http, server -> http.execute(server.getFormListRequest()), "Data Viewer", consumer); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,8 @@ | |
import org.opendatakit.briefcase.reused.transfer.CentralServer; | ||
import org.opendatakit.briefcase.transfer.TransferForms; | ||
import org.opendatakit.briefcase.ui.reused.transfer.sourcetarget.SourceOrTarget; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public interface PushTarget<T> extends SourceOrTarget<T> { | ||
Logger log = LoggerFactory.getLogger(PushTarget.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
static void clearSourcePrefs(BriefcasePreferences prefs) { | ||
AggregateServer.clearStoredPrefs(prefs); | ||
CentralServer.clearStoredPrefs(prefs); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is done with
Iso8601Helpers