Skip to content
Snippets Groups Projects
Commit 0e1e729d authored by Wei Liu's avatar Wei Liu
Browse files

corrected --level arg

parent f2fb7835
No related branches found
No related tags found
No related merge requests found
...@@ -49,8 +49,8 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -49,8 +49,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
private String token; private String token;
@Option(names = { "-l", @Option(names = { "-l",
"--levels" }, paramLabel = "<n>", description = "Number of levels of sub-directories to search. Defaults to 1.", defaultValue = "1") "--level" }, paramLabel = "<n>", description = "Level of sub-directories to search. Defaults to 1.", defaultValue = "1")
private int levels; private int level;
@Option(names = { "-a", @Option(names = { "-a",
"--after" }, paramLabel = "<dd-MMM-yyyy>", description = "Include only the data directories modified after this date (inclusive).", converter = DateTimeConverter.class) "--after" }, paramLabel = "<dd-MMM-yyyy>", description = "Include only the data directories modified after this date (inclusive).", converter = DateTimeConverter.class)
...@@ -96,8 +96,8 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -96,8 +96,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
if (!settings.hasShareableIdOrToken()) { if (!settings.hasShareableIdOrToken()) {
throw new IllegalArgumentException("No shareable id or token is specified!"); throw new IllegalArgumentException("No shareable id or token is specified!");
} }
if (this.levels > 0) { if (this.level > 0) {
settings.setLevels(this.levels); settings.setLevel(this.level);
} }
if (this.modifiedAfter != null) { if (this.modifiedAfter != null) {
settings.setAfter(this.modifiedAfter); settings.setAfter(this.modifiedAfter);
...@@ -118,7 +118,7 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -118,7 +118,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
Set<LocalDirectory> missingDirectories = new LinkedHashSet<>(); Set<LocalDirectory> missingDirectories = new LinkedHashSet<>();
Map<LocalDirectory, Upload> mismatchDirectories = new LinkedHashMap<>(); Map<LocalDirectory, Upload> mismatchDirectories = new LinkedHashMap<>();
checkDirectories(settings.parentDirectories(), settings.levels(), settings.after(), settings.before(), uploads, checkDirectories(settings.parentDirectories(), settings.level(), settings.after(), settings.before(), uploads,
missingDirectories, mismatchDirectories); missingDirectories, mismatchDirectories);
if (!missingDirectories.isEmpty()) { if (!missingDirectories.isEmpty()) {
...@@ -174,7 +174,7 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -174,7 +174,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
} }
} }
private void checkDirectories(Path parentDir, int levels, Date after, Date before, List<Upload> uploads, private void checkDirectories(Path parentDir, int level, Date after, Date before, List<Upload> uploads,
Set<LocalDirectory> missingDirs, Map<LocalDirectory, Upload> mismatchDirs) throws IOException { Set<LocalDirectory> missingDirs, Map<LocalDirectory, Upload> mismatchDirs) throws IOException {
int rootDepth = parentDir.getNameCount(); int rootDepth = parentDir.getNameCount();
...@@ -186,10 +186,10 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -186,10 +186,10 @@ public class InstrumentUploadMissingFind implements MFCommand {
Objects.requireNonNull(dir); Objects.requireNonNull(dir);
Objects.requireNonNull(attrs); Objects.requireNonNull(attrs);
int depth = dir.getNameCount(); int depth = dir.getNameCount();
if (depth > rootDepth + levels) { if (depth > rootDepth + level) {
return FileVisitResult.SKIP_SUBTREE; return FileVisitResult.SKIP_SUBTREE;
} }
if (depth > rootDepth) { if (depth == rootDepth + level) {
if (lastModifiedTimeMatches(attrs.lastModifiedTime(), after, before)) { if (lastModifiedTimeMatches(attrs.lastModifiedTime(), after, before)) {
checkDirectory(dir, uploads, missingDirs, mismatchDirs); checkDirectory(dir, uploads, missingDirs, mismatchDirs);
} }
...@@ -245,7 +245,7 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -245,7 +245,7 @@ public class InstrumentUploadMissingFind implements MFCommand {
public static class Settings { public static class Settings {
private Long _id; private Long _id;
private String _token; private String _token;
private int _levels; private int _level;
private Date _after; private Date _after;
private Date _before; private Date _before;
private boolean _compare = false; private boolean _compare = false;
...@@ -259,8 +259,8 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -259,8 +259,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
return _token; return _token;
} }
int levels() { int level() {
return _levels; return _level;
} }
Date before() { Date before() {
...@@ -289,8 +289,8 @@ public class InstrumentUploadMissingFind implements MFCommand { ...@@ -289,8 +289,8 @@ public class InstrumentUploadMissingFind implements MFCommand {
return this; return this;
} }
public Settings setLevels(int levels) { public Settings setLevel(int level) {
_levels = levels; _level = level;
return this; return this;
} }
......
...@@ -16,6 +16,6 @@ if exist "%JRE%\" ( ...@@ -16,6 +16,6 @@ if exist "%JRE%\" (
set JAR=%ROOT%\lib\unimelb-mf-clients.jar set JAR=%ROOT%\lib\unimelb-mf-clients.jar
"%JAVA%" -XX:+UseG1GC -XX:+UseStringDeduplication -Xmx1g -cp "%JAR%" unimelb.mf.client.instrument.cli.InstrumentUploadList %* "%JAVA%" -XX:+UseG1GC -XX:+UseStringDeduplication -Xmx1g -cp "%JAR%" unimelb.mf.client.instrument.cli.InstrumentUploadMissingFind %*
endlocal endlocal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment