aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2020-08-10 14:59:21 +0100
committerwaynedunican <wayne.dunican@est.tech>2020-08-12 10:27:30 +0100
commit1798f96670cc2d182628332ffec5e012816c82ea (patch)
tree9aeb4ee70c3d4362528a5f1d3028181f212524d4 /client
parente9261d520a496881c315fe28aa9095f59d579e0a (diff)
SONAR cleanup
Removed the "result != null" checks Issue-ID: POLICY-2768 Change-Id: Ibf174fbbb99512b1847b319931bc17a984fb8cc0 Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'client')
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextAlbumHandler.java25
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextSchemaHandler.java27
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java12
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java34
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/PolicyHandler.java33
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/TaskHandler.java29
6 files changed, 95 insertions, 65 deletions
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextAlbumHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextAlbumHandler.java
index 88f03608a..40c147e7a 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextAlbumHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextAlbumHandler.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -109,9 +110,11 @@ public class ContextAlbumHandler implements RestCommandHandler {
jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(),
jsonbean.getDescription());
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextAlbum/Create" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextAlbum/Create" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -135,9 +138,11 @@ public class ContextAlbumHandler implements RestCommandHandler {
jsonbean.getItemSchema().getName(), jsonbean.getItemSchema().getVersion(), jsonbean.getUuid(),
jsonbean.getDescription());
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextAlbum/Update" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextAlbum/Update" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -177,9 +182,11 @@ public class ContextAlbumHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().deleteContextAlbum(blank2Null(name), blank2Null(version));
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextAlbum/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextAlbum/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextSchemaHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextSchemaHandler.java
index 3328f60d4..3805e1e1c 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextSchemaHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ContextSchemaHandler.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -104,9 +105,11 @@ public class ContextSchemaHandler implements RestCommandHandler {
jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(),
jsonbean.getUuid(), jsonbean.getDescription());
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextSchema/create" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextSchema/create" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -128,9 +131,11 @@ public class ContextSchemaHandler implements RestCommandHandler {
jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(),
jsonbean.getUuid(), jsonbean.getDescription());
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextSchema/Update" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextSchema/Update" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -166,15 +171,17 @@ public class ContextSchemaHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().deleteContextSchema(blank2Null(name), blank2Null(version));
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("ContextSchema/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("ContextSchema/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
/**
* Validate a context schema.
- *
+ *
* @param session the session holding the Apex model
* @param name the context schema name to operate on
* @param version the context schema version to operate on
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
index 7c0d795bc..60ebdd58d 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/EventHandler.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ public class EventHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Event/Create" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Event/Create" + (result.isOk() ? OK : NOT_OK));
return result;
}
@@ -197,7 +197,7 @@ public class EventHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Event/Update" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Event/Update" + (result.isOk() ? OK : NOT_OK));
return result;
}
@@ -237,9 +237,11 @@ public class EventHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().deleteEvent(blank2Null(name), blank2Null(version));
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Event/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Event/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
index c865215a5..49163ab84 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/ModelHandler.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,9 +129,11 @@ public class ModelHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().loadFromString(jsonString);
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Model/Load" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Model/Load" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -187,9 +189,10 @@ public class ModelHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().createModel(jsonbean.getName(), jsonbean.getVersion(),
jsonbean.getUuid(), jsonbean.getDescription());
- session.finishSession(result.isOk());
-
- LOGGER.exit("Model/Create" + (result != null && result.isOk() ? OK : NOT_OK));
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Model/Create" + (result.isOk() ? OK : NOT_OK));
+ }
return result;
}
@@ -211,9 +214,11 @@ public class ModelHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModelEdited().updateModel(jsonbean.getName(), jsonbean.getVersion(),
jsonbean.getUuid(), jsonbean.getDescription());
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Model/Update" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Model/Update" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
@@ -248,9 +253,10 @@ public class ModelHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModel().listModel();
- result = addKeyInfo2Messages(session, result);
-
- LOGGER.exit("Model/Get" + (result != null && result.isOk() ? OK : NOT_OK));
+ if (result != null) {
+ result = addKeyInfo2Messages(session, result);
+ LOGGER.exit("Model/Get" + (result.isOk() ? OK : NOT_OK));
+ }
return result;
}
@@ -283,9 +289,11 @@ public class ModelHandler implements RestCommandHandler {
ApexApiResult result = session.getApexModel().deleteModel();
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Model/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Model/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/PolicyHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/PolicyHandler.java
index 7de16b044..994d4e6ac 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/PolicyHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/PolicyHandler.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -129,13 +130,13 @@ public class PolicyHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Policy/Create" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Policy/Create" + (result.isOk() ? OK : NOT_OK));
return result;
}
/**
* Create the content of the policy.
- *
+ *
* @param session the Apex model editing session
* @param jsonString the JSON string to be parsed See {@linkplain BeanPolicy}
* @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return true. Any
@@ -185,7 +186,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create a state on the policy.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -221,7 +222,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the content of a state on the policy.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -256,7 +257,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the task selection logic for the state.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -287,7 +288,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the context references for the state.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -333,7 +334,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the state finalizers for the state.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -380,7 +381,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the state outputs for the state.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -434,7 +435,7 @@ public class PolicyHandler implements RestCommandHandler {
/**
* Create the task references for the state.
- *
+ *
* @param session the Apex model editing session
* @param policyName the policy name
* @param policVersion the policy version
@@ -524,7 +525,7 @@ public class PolicyHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Policy/Update" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Policy/Update" + (result.isOk() ? OK : NOT_OK));
return result;
}
@@ -568,9 +569,11 @@ public class PolicyHandler implements RestCommandHandler {
// deleting the task removes all of these
ApexApiResult result = session.getApexModelEdited().deletePolicy(blank2Null(name), blank2Null(version));
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Policy/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Policy/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/TaskHandler.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/TaskHandler.java
index 87f5fca26..3854c6ffb 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/TaskHandler.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/handling/TaskHandler.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -121,13 +122,13 @@ public class TaskHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Task/Create" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Task/Create" + (result.isOk() ? OK : NOT_OK));
return result;
}
/**
* Create the content of the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonString the JSON string to be parsed. See {@linkplain BeanTask}
* @return an ApexAPIResult object. If successful then {@link ApexApiResult#isOk()} will return true. Any
@@ -156,7 +157,7 @@ public class TaskHandler implements RestCommandHandler {
/**
* Create the input fields for the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonbean the ban containing the fields
* @return the result of the operation
@@ -206,7 +207,7 @@ public class TaskHandler implements RestCommandHandler {
/**
* Create the output fields for the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonbean the ban containing the fields
* @return the result of the operation
@@ -255,7 +256,7 @@ public class TaskHandler implements RestCommandHandler {
/**
* Create the task logic for the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonbean the bean containing the logic
* @return the result of the operation
@@ -282,7 +283,7 @@ public class TaskHandler implements RestCommandHandler {
/**
* Create the task parameters for the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonbean the bean containing the parameters
* @return the result of the operation
@@ -321,7 +322,7 @@ public class TaskHandler implements RestCommandHandler {
/**
* Create the context references for the task.
- *
+ *
* @param session the Apex model editing session
* @param jsonbean the bean containing the context references
* @return the result of the operation
@@ -390,7 +391,7 @@ public class TaskHandler implements RestCommandHandler {
session.finishSession(result.isOk());
- LOGGER.exit("Task/Update" + (result != null && result.isOk() ? OK : NOT_OK));
+ LOGGER.exit("Task/Update" + (result.isOk() ? OK : NOT_OK));
return result;
}
@@ -433,9 +434,11 @@ public class TaskHandler implements RestCommandHandler {
// deleting the task removes all of these
ApexApiResult result = session.getApexModelEdited().deleteTask(blank2Null(name), blank2Null(version));
- session.finishSession(result.isOk());
+ if (result != null) {
+ session.finishSession(result.isOk());
+ LOGGER.exit("Task/Delete" + (result.isOk() ? OK : NOT_OK));
+ }
- LOGGER.exit("Task/Delete" + (result != null && result.isOk() ? OK : NOT_OK));
return result;
}