From d100854291559df1426ea1e64351872ae2d3867b Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 10 Sep 2018 17:05:36 +0100 Subject: Checkstyle changes for apex model Fix checkstyle warnings in the apex mode and knock on changes. Issue-ID: POLICY-1034 Change-Id: I10537e4288e9cad5ef18165ed2cdc1d3ab3139c1 Signed-off-by: liamfallon --- .../apex/auth/clieditor/ApexCLIEditorMain.java | 6 ++--- .../apex/auth/clieditor/ApexModelHandler.java | 16 ++++++------- .../policy/apex/auth/clieditor/CLICommand.java | 2 +- .../policy/apex/auth/clieditor/CLIEditorLoop.java | 28 +++++++++++----------- 4 files changed, 26 insertions(+), 26 deletions(-) (limited to 'auth/cli-editor/src/main/java/org') diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java index c7f7c7bb1..718c75a96 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexCLIEditorMain.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.Set; import java.util.TreeSet; -import org.onap.policy.apex.model.utilities.json.JSONHandler; +import org.onap.policy.apex.model.utilities.json.JsonHandler; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -77,7 +77,7 @@ public class ApexCLIEditorMain { // Read the command definitions try { - commands = new JSONHandler().read(CLICommands.class, parameters.getMetadataStream()); + commands = new JsonHandler().read(CLICommands.class, parameters.getMetadataStream()); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading command metadata from {}", parameters.getMetadataLocation(), e); @@ -97,7 +97,7 @@ public class ApexCLIEditorMain { // Read the Apex properties try { - apexModelProperties = new JSONHandler().read(ApexModelProperties.class, + apexModelProperties = new JsonHandler().read(ApexModelProperties.class, parameters.getApexPropertiesStream()); } catch (final Exception e) { LOGGER.error("start of Apex command line editor failed, error reading Apex model properties from " diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java index bfa2239f2..2cf2633b2 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/ApexModelHandler.java @@ -26,7 +26,7 @@ import java.lang.reflect.Method; import java.util.Properties; import java.util.TreeMap; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult; import org.onap.policy.apex.model.modelapi.ApexModel; import org.onap.policy.apex.model.modelapi.ApexModelFactory; @@ -62,8 +62,8 @@ public class ApexModelHandler { return; } - final ApexAPIResult result = apexModel.loadFromFile(modelFileName); - if (result.isNOK()) { + final ApexApiResult result = apexModel.loadFromFile(modelFileName); + if (result.isNok()) { throw new CLIException(result.getMessages().get(0)); } } @@ -76,7 +76,7 @@ public class ApexModelHandler { * @param writer A writer to which to write output * @return the result of the executed command */ - public ApexAPIResult executeCommand(final CLICommand command, + public ApexApiResult executeCommand(final CLICommand command, final TreeMap argumentValues, final PrintWriter writer) { // Get the method final Method apiMethod = getCommandMethod(command); @@ -87,8 +87,8 @@ public class ApexModelHandler { try { final Object returnObject = apiMethod.invoke(apexModel, parameterArray); - if (returnObject instanceof ApexAPIResult) { - final ApexAPIResult result = (ApexAPIResult) returnObject; + if (returnObject instanceof ApexApiResult) { + final ApexApiResult result = (ApexApiResult) returnObject; writer.println(result); return result; } else { @@ -176,9 +176,9 @@ public class ApexModelHandler { * @return the string */ public String writeModelToString(final PrintWriter messageWriter) { - final ApexAPIResult result = apexModel.listModel(); + final ApexApiResult result = apexModel.listModel(); - if (result.isOK()) { + if (result.isOk()) { return result.getMessage(); } else { return null; diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java index 7f4333cd8..40c0a40a5 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLICommand.java @@ -27,7 +27,7 @@ import org.onap.policy.apex.model.utilities.Assertions; /** * This class represents a single Apex CLI command that is issued to the Apex Editor Java API - * {@link org.onap.policy.apex.model.modelapi.ApexEditorAPI}. + * {@link org.onap.policy.apex.model.modelapi.ApexEditorApi}. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java index 4eacde04b..a574099bf 100644 --- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java +++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/CLIEditorLoop.java @@ -39,8 +39,8 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.TreeMap; -import org.onap.policy.apex.model.modelapi.ApexAPIResult; -import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT; +import org.onap.policy.apex.model.modelapi.ApexApiResult; +import org.onap.policy.apex.model.modelapi.ApexApiResult.Result; import org.onap.policy.apex.model.utilities.TextFileUtils; import org.onap.policy.apex.model.utilities.TreeMapUtils; @@ -102,8 +102,8 @@ public class CLIEditorLoop { // The main loop for command handing, it continues until EOF on the input stream or until a // quit command int errorCount = 0; - ApexAPIResult result = new ApexAPIResult(); - while (result.getResult() != RESULT.FINISHED) { + ApexApiResult result = new ApexApiResult(); + while (result.getResult() != Result.FINISHED) { if (!parameters.isIgnoreCommandFailures() && errorCount > 0) { break; } @@ -184,7 +184,7 @@ public class CLIEditorLoop { // Execute the command, a FINISHED result means a command causes the loop to // leave execution result = executeCommand(command, argumentValues, writer); - if (result.isNOK()) { + if (result.isNok()) { errorCount++; } } @@ -381,7 +381,7 @@ public class CLIEditorLoop { * @param writer The writer to use for any output from the command * @return the result of execution of the command */ - private ApexAPIResult executeCommand(final CLICommand command, + private ApexApiResult executeCommand(final CLICommand command, final TreeMap argumentValues, final PrintWriter writer) { if (command.isSystemCommand()) { return exceuteSystemCommand(command, writer); @@ -397,7 +397,7 @@ public class CLIEditorLoop { * @param writer The writer to use for any output from the command * @return the result of execution of the command */ - private ApexAPIResult exceuteSystemCommand(final CLICommand command, final PrintWriter writer) { + private ApexApiResult exceuteSystemCommand(final CLICommand command, final PrintWriter writer) { if ("back".equals(command.getName())) { return executeBackCommand(); } else if ("help".equals(command.getName())) { @@ -405,7 +405,7 @@ public class CLIEditorLoop { } else if ("quit".equals(command.getName())) { return executeQuitCommand(); } else { - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } } @@ -414,11 +414,11 @@ public class CLIEditorLoop { * * @return the result of execution of the command */ - private ApexAPIResult executeBackCommand() { + private ApexApiResult executeBackCommand() { if (keywordNodeDeque.size() > 1) { keywordNodeDeque.pop(); } - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } /** @@ -426,8 +426,8 @@ public class CLIEditorLoop { * * @return the result of execution of the command */ - private ApexAPIResult executeQuitCommand() { - return new ApexAPIResult(RESULT.FINISHED); + private ApexApiResult executeQuitCommand() { + return new ApexApiResult(Result.FINISHED); } /** @@ -436,11 +436,11 @@ public class CLIEditorLoop { * @param writer The writer to use for output from the command * @return the result of execution of the command */ - private ApexAPIResult executeHelpCommand(final PrintWriter writer) { + private ApexApiResult executeHelpCommand(final PrintWriter writer) { for (final CLICommand command : keywordNodeDeque.peek().getCommands()) { writer.println(command.getHelp()); } - return new ApexAPIResult(RESULT.SUCCESS); + return new ApexApiResult(Result.SUCCESS); } /** -- cgit 1.2.3-korg