mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
fix stylecheck
This commit is contained in:
@@ -147,14 +147,12 @@ public class ScriptLauncher {
|
||||
DSpaceRunnable script) {
|
||||
try {
|
||||
StepResult result = script.initialize(args, dSpaceRunnableHandler, null);
|
||||
|
||||
if (StepResult.Continue.equals(result)) {
|
||||
// only run the script, if the normal initialize is successful
|
||||
script.run();
|
||||
} else {
|
||||
// otherwise - for example the script is started with the help argument
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch (ParseException e) {
|
||||
script.printHelp();
|
||||
|
@@ -69,8 +69,8 @@ public abstract class DSpaceRunnable<T extends ScriptConfiguration> implements R
|
||||
* @param args The arguments given to the script
|
||||
* @param dSpaceRunnableHandler The DSpaceRunnableHandler object that defines from where the script was ran
|
||||
* @param currentUser
|
||||
* @return the result of this step; StepResult.Continue: continue the normal process, initialize is successful;
|
||||
* otherwise exit the process (the help or version is shown)
|
||||
* @return the result of this step; StepResult.Continue: continue the normal process,
|
||||
* initialize is successful; otherwise exit the process (the help or version is shown)
|
||||
* @throws ParseException If something goes wrong
|
||||
*/
|
||||
public StepResult initialize(String[] args, DSpaceRunnableHandler dSpaceRunnableHandler,
|
||||
@@ -93,14 +93,17 @@ public abstract class DSpaceRunnable<T extends ScriptConfiguration> implements R
|
||||
// arguments of the command line matches NOT the help options, parse the args for the normal options
|
||||
result = this.parse(args);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/** This method handle the help command line. In this easy implementation only the help is printed.
|
||||
* For more complexity override this method.
|
||||
/**
|
||||
* This method handle the help command line. In this easy implementation only the help is printed. For more
|
||||
* complexity override this method.
|
||||
*/
|
||||
private void handleHelpCommandLine() {
|
||||
printHelp();
|
||||
@@ -202,7 +205,6 @@ public abstract class DSpaceRunnable<T extends ScriptConfiguration> implements R
|
||||
}
|
||||
|
||||
public enum StepResult {
|
||||
Continue,
|
||||
Exit;
|
||||
Continue, Exit;
|
||||
}
|
||||
}
|
||||
|
@@ -108,14 +108,13 @@ public abstract class ScriptConfiguration<T extends DSpaceRunnable> implements B
|
||||
|
||||
/**
|
||||
* The getter for the options of the Script (help informations)
|
||||
*
|
||||
* @return the options value of this ScriptConfiguration for help
|
||||
*/
|
||||
public Options getHelpOptions() {
|
||||
Options options = new Options();
|
||||
|
||||
options.addOption(Option.builder("h").longOpt("help")
|
||||
.desc("help")
|
||||
.hasArg(false).required(false).build());
|
||||
options.addOption(Option.builder("h").longOpt("help").desc("help").hasArg(false).required(false).build());
|
||||
|
||||
return options;
|
||||
}
|
||||
|
@@ -702,7 +702,8 @@ public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDat
|
||||
script = scriptService.createDSpaceRunnableForScriptConfiguration(scriptConfiguration);
|
||||
}
|
||||
if (script != null) {
|
||||
if (DSpaceRunnable.StepResult.Continue.equals(script.initialize(args, testDSpaceRunnableHandler, null))) {
|
||||
if (DSpaceRunnable.StepResult.Continue
|
||||
.equals(script.initialize(args, testDSpaceRunnableHandler, null))) {
|
||||
script.run();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user