mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 16:03:07 +00:00
88141: Update script converter comment and clean up setType(boolean)
This commit is contained in:
@@ -41,10 +41,8 @@ public class MetadataDeletionScriptConfiguration<T extends MetadataDeletion> ext
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("m", "metadata", true, "metadata field name");
|
options.addOption("m", "metadata", true, "metadata field name");
|
||||||
options.getOption("m").setType(String.class);
|
|
||||||
|
|
||||||
options.addOption("l", "list", false, "lists the metadata fields that can be deleted");
|
options.addOption("l", "list", false, "lists the metadata fields that can be deleted");
|
||||||
options.getOption("l").setType(boolean.class);
|
|
||||||
|
|
||||||
super.options = options;
|
super.options = options;
|
||||||
}
|
}
|
||||||
|
@@ -54,12 +54,9 @@ public class MetadataExportScriptConfiguration<T extends MetadataExport> extends
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("i", "id", true, "ID or handle of thing to export (item, collection, or community)");
|
options.addOption("i", "id", true, "ID or handle of thing to export (item, collection, or community)");
|
||||||
options.getOption("i").setType(String.class);
|
|
||||||
options.addOption("a", "all", false,
|
options.addOption("a", "all", false,
|
||||||
"include all metadata fields that are not normally changed (e.g. provenance)");
|
"include all metadata fields that are not normally changed (e.g. provenance)");
|
||||||
options.getOption("a").setType(boolean.class);
|
|
||||||
options.addOption("h", "help", false, "help");
|
options.addOption("h", "help", false, "help");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
|
|
||||||
super.options = options;
|
super.options = options;
|
||||||
|
@@ -19,7 +19,6 @@ public class MetadataImportCliScriptConfiguration extends MetadataImportScriptCo
|
|||||||
public Options getOptions() {
|
public Options getOptions() {
|
||||||
Options options = super.getOptions();
|
Options options = super.getOptions();
|
||||||
options.addOption("e", "email", true, "email address or user id of user (required if adding new items)");
|
options.addOption("e", "email", true, "email address or user id of user (required if adding new items)");
|
||||||
options.getOption("e").setType(String.class);
|
|
||||||
options.getOption("e").setRequired(true);
|
options.getOption("e").setRequired(true);
|
||||||
super.options = options;
|
super.options = options;
|
||||||
return options;
|
return options;
|
||||||
|
@@ -59,20 +59,14 @@ public class MetadataImportScriptConfiguration<T extends MetadataImport> extends
|
|||||||
options.getOption("f").setRequired(true);
|
options.getOption("f").setRequired(true);
|
||||||
options.addOption("s", "silent", false,
|
options.addOption("s", "silent", false,
|
||||||
"silent operation - doesn't request confirmation of changes USE WITH CAUTION");
|
"silent operation - doesn't request confirmation of changes USE WITH CAUTION");
|
||||||
options.getOption("s").setType(boolean.class);
|
|
||||||
options.addOption("w", "workflow", false, "workflow - when adding new items, use collection workflow");
|
options.addOption("w", "workflow", false, "workflow - when adding new items, use collection workflow");
|
||||||
options.getOption("w").setType(boolean.class);
|
|
||||||
options.addOption("n", "notify", false,
|
options.addOption("n", "notify", false,
|
||||||
"notify - when adding new items using a workflow, send notification emails");
|
"notify - when adding new items using a workflow, send notification emails");
|
||||||
options.getOption("n").setType(boolean.class);
|
|
||||||
options.addOption("v", "validate-only", false,
|
options.addOption("v", "validate-only", false,
|
||||||
"validate - just validate the csv, don't run the import");
|
"validate - just validate the csv, don't run the import");
|
||||||
options.getOption("v").setType(boolean.class);
|
|
||||||
options.addOption("t", "template", false,
|
options.addOption("t", "template", false,
|
||||||
"template - when adding new items, use the collection template (if it exists)");
|
"template - when adding new items, use the collection template (if it exists)");
|
||||||
options.getOption("t").setType(boolean.class);
|
|
||||||
options.addOption("h", "help", false, "help");
|
options.addOption("h", "help", false, "help");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
super.options = options;
|
super.options = options;
|
||||||
}
|
}
|
||||||
|
@@ -43,22 +43,14 @@ public class HarvestScriptConfiguration<T extends Harvest> extends ScriptConfigu
|
|||||||
public Options getOptions() {
|
public Options getOptions() {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
options.addOption("p", "purge", false, "delete all items in the collection");
|
options.addOption("p", "purge", false, "delete all items in the collection");
|
||||||
options.getOption("p").setType(boolean.class);
|
|
||||||
options.addOption("r", "run", false, "run the standard harvest procedure");
|
options.addOption("r", "run", false, "run the standard harvest procedure");
|
||||||
options.getOption("r").setType(boolean.class);
|
|
||||||
options.addOption("g", "ping", false, "test the OAI server and set");
|
options.addOption("g", "ping", false, "test the OAI server and set");
|
||||||
options.getOption("g").setType(boolean.class);
|
|
||||||
options.addOption("s", "setup", false, "Set the collection up for harvesting");
|
options.addOption("s", "setup", false, "Set the collection up for harvesting");
|
||||||
options.getOption("s").setType(boolean.class);
|
|
||||||
options.addOption("S", "start", false, "start the harvest loop");
|
options.addOption("S", "start", false, "start the harvest loop");
|
||||||
options.getOption("S").setType(boolean.class);
|
|
||||||
options.addOption("R", "reset", false, "reset harvest status on all collections");
|
options.addOption("R", "reset", false, "reset harvest status on all collections");
|
||||||
options.getOption("R").setType(boolean.class);
|
|
||||||
options.addOption("P", "purgeCollections", false, "purge all harvestable collections");
|
options.addOption("P", "purgeCollections", false, "purge all harvestable collections");
|
||||||
options.getOption("P").setType(boolean.class);
|
|
||||||
options.addOption("o", "reimport", false, "reimport all items in the collection, " +
|
options.addOption("o", "reimport", false, "reimport all items in the collection, " +
|
||||||
"this is equivalent to -p -r, purging all items in a collection and reimporting them");
|
"this is equivalent to -p -r, purging all items in a collection and reimporting them");
|
||||||
options.getOption("o").setType(boolean.class);
|
|
||||||
options.addOption("c", "collection", true,
|
options.addOption("c", "collection", true,
|
||||||
"harvesting collection (handle or id)");
|
"harvesting collection (handle or id)");
|
||||||
options.addOption("t", "type", true,
|
options.addOption("t", "type", true,
|
||||||
@@ -72,7 +64,6 @@ public class HarvestScriptConfiguration<T extends Harvest> extends ScriptConfigu
|
|||||||
"crosswalk in dspace.cfg");
|
"crosswalk in dspace.cfg");
|
||||||
|
|
||||||
options.addOption("h", "help", false, "help");
|
options.addOption("h", "help", false, "help");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@@ -50,15 +50,11 @@ public class MediaFilterScriptConfiguration<T extends MediaFilterScript> extends
|
|||||||
public Options getOptions() {
|
public Options getOptions() {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
options.addOption("v", "verbose", false, "print all extracted text and other details to STDOUT");
|
options.addOption("v", "verbose", false, "print all extracted text and other details to STDOUT");
|
||||||
options.getOption("v").setType(boolean.class);
|
|
||||||
options.addOption("q", "quiet", false, "do not print anything except in the event of errors.");
|
options.addOption("q", "quiet", false, "do not print anything except in the event of errors.");
|
||||||
options.getOption("q").setType(boolean.class);
|
|
||||||
options.addOption("f", "force", false, "force all bitstreams to be processed");
|
options.addOption("f", "force", false, "force all bitstreams to be processed");
|
||||||
options.getOption("f").setType(boolean.class);
|
|
||||||
options.addOption("i", "identifier", true, "ONLY process bitstreams belonging to identifier");
|
options.addOption("i", "identifier", true, "ONLY process bitstreams belonging to identifier");
|
||||||
options.addOption("m", "maximum", true, "process no more than maximum items");
|
options.addOption("m", "maximum", true, "process no more than maximum items");
|
||||||
options.addOption("h", "help", false, "help");
|
options.addOption("h", "help", false, "help");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
Option pluginOption = Option.builder("p")
|
Option pluginOption = Option.builder("p")
|
||||||
.longOpt("plugins")
|
.longOpt("plugins")
|
||||||
|
@@ -19,7 +19,6 @@ public class CurationCliScriptConfiguration extends CurationScriptConfiguration<
|
|||||||
public Options getOptions() {
|
public Options getOptions() {
|
||||||
options = super.getOptions();
|
options = super.getOptions();
|
||||||
options.addOption("e", "eperson", true, "email address of curating eperson");
|
options.addOption("e", "eperson", true, "email address of curating eperson");
|
||||||
options.getOption("e").setType(String.class);
|
|
||||||
options.getOption("e").setRequired(true);
|
options.getOption("e").setRequired(true);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@@ -74,25 +74,17 @@ public enum IndexClientOptions {
|
|||||||
|
|
||||||
options
|
options
|
||||||
.addOption("r", "remove", true, "remove an Item, Collection or Community from index based on its handle");
|
.addOption("r", "remove", true, "remove an Item, Collection or Community from index based on its handle");
|
||||||
options.getOption("r").setType(String.class);
|
|
||||||
options.addOption("i", "index", true,
|
options.addOption("i", "index", true,
|
||||||
"add or update an Item, Collection or Community based on its handle or uuid");
|
"add or update an Item, Collection or Community based on its handle or uuid");
|
||||||
options.getOption("i").setType(boolean.class);
|
|
||||||
options.addOption("c", "clean", false,
|
options.addOption("c", "clean", false,
|
||||||
"clean existing index removing any documents that no longer exist in the db");
|
"clean existing index removing any documents that no longer exist in the db");
|
||||||
options.getOption("c").setType(boolean.class);
|
|
||||||
options.addOption("d", "delete", false,
|
options.addOption("d", "delete", false,
|
||||||
"delete all records from existing index");
|
"delete all records from existing index");
|
||||||
options.getOption("d").setType(boolean.class);
|
|
||||||
options.addOption("b", "build", false, "(re)build index, wiping out current one if it exists");
|
options.addOption("b", "build", false, "(re)build index, wiping out current one if it exists");
|
||||||
options.getOption("b").setType(boolean.class);
|
|
||||||
options.addOption("s", "spellchecker", false, "Rebuild the spellchecker, can be combined with -b and -f.");
|
options.addOption("s", "spellchecker", false, "Rebuild the spellchecker, can be combined with -b and -f.");
|
||||||
options.getOption("s").setType(boolean.class);
|
|
||||||
options.addOption("f", "force", false,
|
options.addOption("f", "force", false,
|
||||||
"if updating existing index, force each handle to be reindexed even if uptodate");
|
"if updating existing index, force each handle to be reindexed even if uptodate");
|
||||||
options.getOption("f").setType(boolean.class);
|
|
||||||
options.addOption("h", "help", false, "print this help message");
|
options.addOption("h", "help", false, "print this help message");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,15 +56,12 @@ public class RetryFailedOpenUrlTrackerScriptConfiguration<T extends RetryFailedO
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("a", true, "Add a new \"failed\" row to the table with a url (test purposes only)");
|
options.addOption("a", true, "Add a new \"failed\" row to the table with a url (test purposes only)");
|
||||||
options.getOption("a").setType(String.class);
|
|
||||||
|
|
||||||
options.addOption("r", false,
|
options.addOption("r", false,
|
||||||
"Retry sending requests to all urls stored in the table with failed requests. " +
|
"Retry sending requests to all urls stored in the table with failed requests. " +
|
||||||
"This includes the url that can be added through the -a option.");
|
"This includes the url that can be added through the -a option.");
|
||||||
options.getOption("r").setType(boolean.class);
|
|
||||||
|
|
||||||
options.addOption("h", "help", false, "print this help message");
|
options.addOption("h", "help", false, "print this help message");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
super.options = options;
|
super.options = options;
|
||||||
}
|
}
|
||||||
|
@@ -53,11 +53,8 @@ public class SubmissionFormsMigrationCliScriptConfiguration<T extends Submission
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("f", "input-forms", true, "Path to source input-forms.xml file location");
|
options.addOption("f", "input-forms", true, "Path to source input-forms.xml file location");
|
||||||
options.getOption("f").setType(String.class);
|
|
||||||
options.addOption("s", "item-submission", true, "Path to source item-submission.xml file location");
|
options.addOption("s", "item-submission", true, "Path to source item-submission.xml file location");
|
||||||
options.getOption("s").setType(String.class);
|
|
||||||
options.addOption("h", "help", false, "help");
|
options.addOption("h", "help", false, "help");
|
||||||
options.getOption("h").setType(boolean.class);
|
|
||||||
|
|
||||||
super.options = options;
|
super.options = options;
|
||||||
}
|
}
|
||||||
|
@@ -54,9 +54,7 @@ public class MockDSpaceRunnableScriptConfiguration<T extends MockDSpaceRunnableS
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("r", "remove", true, "description r");
|
options.addOption("r", "remove", true, "description r");
|
||||||
options.getOption("r").setType(String.class);
|
|
||||||
options.addOption("i", "index", false, "description i");
|
options.addOption("i", "index", false, "description i");
|
||||||
options.getOption("i").setType(boolean.class);
|
|
||||||
options.getOption("i").setRequired(true);
|
options.getOption("i").setRequired(true);
|
||||||
options.addOption("f", "file", true, "source file");
|
options.addOption("f", "file", true, "source file");
|
||||||
options.getOption("f").setType(InputStream.class);
|
options.getOption("f").setType(InputStream.class);
|
||||||
|
@@ -50,11 +50,14 @@ public class ScriptConverter implements DSpaceConverter<ScriptConfiguration, Scr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the type string for this option
|
* Retrieve the type for this Option. In Apache Commons CLI, Option objects default to a "String" type.
|
||||||
*
|
*
|
||||||
* String is the default option class when no alternative is set. However, DSpace angular will force an argument
|
* In most situations, the Option type will correspond to the Java Class name (e.g. "String", "boolean", etc.).
|
||||||
* when the type is set to string. Therefor, this method will return the boolean type when the option is of type
|
* However, when the Option type is "String" (the default) and the Option is configured to not allow for
|
||||||
* string and does require an argument.
|
* additional arguments (hasArg=false), we switch the type to be "boolean". This behavior is necessary to ensure
|
||||||
|
* our REST API differentiates between an Option that requires an additional argument (which our REST API returns
|
||||||
|
* as a "String" type), and an Option which does not accept additional arguments (which is just a boolean flag
|
||||||
|
* used to trigger different behavior, hence a "boolean" type is more appropriate).
|
||||||
*
|
*
|
||||||
* @param option Option to retrieve the type for
|
* @param option Option to retrieve the type for
|
||||||
* @return the type of the option based on the aforementioned logic
|
* @return the type of the option based on the aforementioned logic
|
||||||
|
@@ -37,7 +37,6 @@ public class TypeConversionTestScriptConfiguration<T extends TypeConversionTestS
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("b", "boolean", false, "option set to the boolean class");
|
options.addOption("b", "boolean", false, "option set to the boolean class");
|
||||||
options.getOption("b").setType(boolean.class);
|
|
||||||
options.addOption("s", "string", true, "string option with an argument");
|
options.addOption("s", "string", true, "string option with an argument");
|
||||||
options.addOption("n", "noargument", false, "string option without an argument");
|
options.addOption("n", "noargument", false, "string option without an argument");
|
||||||
options.addOption("f", "file", true, "file option with an argument");
|
options.addOption("f", "file", true, "file option with an argument");
|
||||||
|
@@ -54,9 +54,7 @@ public class MockDSpaceRunnableScriptConfiguration<T extends MockDSpaceRunnableS
|
|||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
|
|
||||||
options.addOption("r", "remove", true, "description r");
|
options.addOption("r", "remove", true, "description r");
|
||||||
options.getOption("r").setType(String.class);
|
|
||||||
options.addOption("i", "index", false, "description i");
|
options.addOption("i", "index", false, "description i");
|
||||||
options.getOption("i").setType(boolean.class);
|
|
||||||
options.getOption("i").setRequired(true);
|
options.getOption("i").setRequired(true);
|
||||||
options.addOption("f", "file", true, "source file");
|
options.addOption("f", "file", true, "source file");
|
||||||
options.getOption("f").setType(InputStream.class);
|
options.getOption("f").setType(InputStream.class);
|
||||||
|
Reference in New Issue
Block a user