Knock on of changing policy types to map
[policy/api.git] / main / src / main / java / org / onap / policy / api / main / rest / provider / CommonModelProvider.java
index f3634b3..fc0f436 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP Policy API\r
  * ================================================================================\r
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.\r
+ * Modifications Copyright (C) 2019 Nordix Foundation.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -101,14 +102,26 @@ public class CommonModelProvider implements AutoCloseable {
     }\r
 \r
     /**\r
-     * Checks if the first element of a list contains data.\r
+     * Checks if the first element of a list of maps contains data.\r
      *\r
-     * @param list list to be examined\r
+     * @param listOfMapsToCheck list of maps to be examined\r
      * @return {@code true} if the list contains data, {@code false} otherwise\r
      */\r
-    protected <T> boolean hasData(List<Map<String, T>> list) {\r
+    protected <T> boolean hasData(List<Map<String, T>> listOfMapsToCheck) {\r
 \r
-        return (list != null && !list.isEmpty() && !list.get(0).isEmpty());\r
+        return (listOfMapsToCheck != null && !listOfMapsToCheck.isEmpty() && !listOfMapsToCheck.get(0).isEmpty());\r
+    }\r
+\r
+\r
+    /**\r
+     * Checks if a maps contains data.\r
+     *\r
+     * @param mapToCheck map to be examined\r
+     * @return {@code true} if the list contains data, {@code false} otherwise\r
+     */\r
+    protected <T> boolean hasData(Map<String, T> mapToCheck) {\r
+\r
+        return (mapToCheck != null && !mapToCheck.isEmpty());\r
     }\r
 \r
     /**\r
@@ -341,4 +354,4 @@ public class CommonModelProvider implements AutoCloseable {
         return "could not find policy with ID " + policyId + " and type "\r
                 + policyType.getName() + ":" + policyType.getVersion() + " deployed in any pdp group";\r
     }\r
-}
\ No newline at end of file
+}\r