diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-25 13:03:21 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-25 13:04:24 +0100 |
commit | da9a362382e3229ddcaa86fd91ac695a1914ebef (patch) | |
tree | 68e26e5e727343f5ee80139e2656fbbdf6c66e01 /model/model-api/src/main/java/org | |
parent | d191116808e4a90035c7e8b2acea0fefa439d13c (diff) |
Fix sonar issues in Command line editor
THe Apex command line editor had issues in teh way its loops for processing
commands were written. The loops are simplified in this review.
Issue-ID: POLICY-1034
Change-Id: If684a57de79bd56211e1ca3e8c446bd9698666be
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/model-api/src/main/java/org')
-rw-r--r-- | model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java index ae2609e1d..ddd46c879 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java @@ -70,7 +70,25 @@ public class ApexApiResult { * The method call failed for another reason such as the method call is not implemented yet * on the concept on which it was called. */ - OTHER_ERROR + OTHER_ERROR; + + /** + * Check if a result is OK. + * + * @return true if the result is not OK + */ + public static boolean isOk(final Result result) { + return result == Result.SUCCESS || result == Result.FINISHED; + } + + /** + * Check if a result is not OK. + * + * @return true if the result is not OK + */ + public static boolean isNok(final Result result) { + return !isOk(result); + } } private Result result; @@ -139,7 +157,7 @@ public class ApexApiResult { */ @XmlAttribute(required = true) public boolean isOk() { - return result == Result.SUCCESS || result == Result.FINISHED; + return Result.isOk(result); } /** @@ -149,7 +167,7 @@ public class ApexApiResult { * @return true, if the result indicates the API operation did not succeed */ public boolean isNok() { - return !isOk(); + return Result.isNok(result); } /** |