fix stylecheck

This commit is contained in:
Christian Bethge
2023-08-07 11:27:08 +02:00
parent 2cd1f887c0
commit b1377ca1ef
7 changed files with 67 additions and 67 deletions

View File

@@ -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();

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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();
}
}