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) { DSpaceRunnable script) {
try { try {
StepResult result = script.initialize(args, dSpaceRunnableHandler, null); StepResult result = script.initialize(args, dSpaceRunnableHandler, null);
if (StepResult.Continue.equals(result)) { if (StepResult.Continue.equals(result)) {
// only run the script, if the normal initialize is successful // only run the script, if the normal initialize is successful
script.run(); script.run();
} else { } else {
// otherwise - for example the script is started with the help argument // otherwise - for example the script is started with the help argument
} }
return 0; return 0;
} catch (ParseException e) { } catch (ParseException e) {
script.printHelp(); 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 args The arguments given to the script
* @param dSpaceRunnableHandler The DSpaceRunnableHandler object that defines from where the script was ran * @param dSpaceRunnableHandler The DSpaceRunnableHandler object that defines from where the script was ran
* @param currentUser * @param currentUser
* @return the result of this step; StepResult.Continue: continue the normal process, initialize is successful; * @return the result of this step; StepResult.Continue: continue the normal process,
* otherwise exit the process (the help or version is shown) * initialize is successful; otherwise exit the process (the help or version is shown)
* @throws ParseException If something goes wrong * @throws ParseException If something goes wrong
*/ */
public StepResult initialize(String[] args, DSpaceRunnableHandler dSpaceRunnableHandler, 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 // arguments of the command line matches NOT the help options, parse the args for the normal options
result = this.parse(args); result = this.parse(args);
break; break;
default:
break;
} }
return result; 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() { private void handleHelpCommandLine() {
printHelp(); printHelp();
@@ -202,7 +205,6 @@ public abstract class DSpaceRunnable<T extends ScriptConfiguration> implements R
} }
public enum StepResult { public enum StepResult {
Continue, Continue, Exit;
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) * The getter for the options of the Script (help informations)
*
* @return the options value of this ScriptConfiguration for help * @return the options value of this ScriptConfiguration for help
*/ */
public Options getHelpOptions() { public Options getHelpOptions() {
Options options = new Options(); Options options = new Options();
options.addOption(Option.builder("h").longOpt("help") options.addOption(Option.builder("h").longOpt("help").desc("help").hasArg(false).required(false).build());
.desc("help")
.hasArg(false).required(false).build());
return options; return options;
} }

View File

@@ -702,7 +702,8 @@ public class CSVMetadataImportReferenceIT extends AbstractIntegrationTestWithDat
script = scriptService.createDSpaceRunnableForScriptConfiguration(scriptConfiguration); script = scriptService.createDSpaceRunnableForScriptConfiguration(scriptConfiguration);
} }
if (script != null) { 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(); script.run();
} }
} }