Renaming variables- issues identified by sonarQube 35/94335/4
authorHelenaLydon <helena.lydon@est.tech>
Fri, 30 Aug 2019 15:32:05 +0000 (15:32 +0000)
committerHelenaLydon <helena.lydon@est.tech>
Fri, 30 Aug 2019 15:32:05 +0000 (15:32 +0000)
Change-Id: I6ee56ee74f29cf196a8624c623b3670f91ef9424
Issue-ID: DMAAP-1195
Signed-off-by: HelenaLydon <helena.lydon@est.tech>
datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java

index 76b9e4b..d38681f 100644 (file)
@@ -59,11 +59,11 @@ public class Feed extends Syncable {
     private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
     private static int nextFeedID = getMaxFeedID() + 1;\r
     private static final String SQLEXCEPTION = "SQLException: ";\r
-    private static final String FEEDID = "FEEDID";\r
-    private static final String feedIDStr = "feedid";\r
-    private static final String deletedStr = "deleted";\r
-    private static final String lastModStr = "last_mod";\r
-    private static final String createdDateStr ="created_date";\r
+    private static final String FEED_ID_SQL = "FEEDID";\r
+    private static final String FEED_ID = "feedid";\r
+    private static final String DEL = "deleted";\r
+    private static final String LAST_MOD = "last_mod";\r
+    private static final String CREATED_DATE = "created_date";\r
 \r
     private int feedid;\r
     private int groupid; //New field is added - Groups feature Rally:US708115 - 1610\r
@@ -114,7 +114,7 @@ public class Feed extends Syncable {
      * @throws SQLException in case of SQL statement error\r
      */\r
     public Feed(ResultSet rs) throws SQLException {\r
-        this.feedid = rs.getInt(FEEDID);\r
+        this.feedid = rs.getInt(FEED_ID_SQL);\r
         //New field is added - Groups feature Rally:US708115 - 1610\r
         this.groupid = rs.getInt("GROUPID");\r
         this.name = rs.getString("NAME");\r
@@ -146,7 +146,7 @@ public class Feed extends Syncable {
         this("", "", "", "");\r
         try {\r
             // The JSONObject is assumed to contain a vnd.dmaap-dr.feed representation\r
-            this.feedid = jo.optInt(feedIDStr, -1);\r
+            this.feedid = jo.optInt(FEED_ID, -1);\r
             this.groupid = jo.optInt("groupid");\r
             this.name = jo.getString("name");\r
             this.aafInstance = jo.optString("aaf_instance", "legacy");\r
@@ -205,7 +205,7 @@ public class Feed extends Syncable {
             }\r
 \r
             this.publisher = jo.optString("publisher", "");\r
-            this.deleted = jo.optBoolean(deletedStr, false);\r
+            this.deleted = jo.optBoolean(DEL, false);\r
             this.suspended = jo.optBoolean("suspend", false);\r
             JSONObject jol = jo.optJSONObject("links");\r
             this.links = (jol == null) ? (new FeedLinks()) : (new FeedLinks(jol));\r
@@ -338,7 +338,7 @@ public class Feed extends Syncable {
                 String sql = "select * from FEED_ENDPOINT_IDS";\r
                 try (ResultSet rs = stmt.executeQuery(sql)) {\r
                     while (rs.next()) {\r
-                        int id = rs.getInt(FEEDID);\r
+                        int id = rs.getInt(FEED_ID_SQL);\r
                         Feed feed = map.get(id);\r
                         if (feed != null) {\r
                             FeedEndpointID epi = new FeedEndpointID(rs);\r
@@ -351,7 +351,7 @@ public class Feed extends Syncable {
                 sql = "select * from FEED_ENDPOINT_ADDRS";\r
                 try (ResultSet rs = stmt.executeQuery(sql)) {\r
                     while (rs.next()) {\r
-                        int id = rs.getInt(FEEDID);\r
+                        int id = rs.getInt(FEED_ID_SQL);\r
                         Feed feed = map.get(id);\r
                         if (feed != null) {\r
                             Collection<String> acoll = feed.getAuthorization().getEndpointAddrs();\r
@@ -568,7 +568,7 @@ public class Feed extends Syncable {
     @Override\r
     public JSONObject asJSONObject() {\r
         JSONObject jo = new JSONObject();\r
-        jo.put(feedIDStr, feedid);\r
+        jo.put(FEED_ID, feedid);\r
         //New field is added - Groups feature Rally:US708115 - 1610\r
         jo.put("groupid", groupid);\r
         jo.put("name", name);\r
@@ -579,10 +579,10 @@ public class Feed extends Syncable {
         jo.put("authorization", authorization.asJSONObject());\r
         jo.put("publisher", publisher);\r
         jo.put("links", links.asJSONObject());\r
-        jo.put(deletedStr, deleted);\r
+        jo.put(DEL, deleted);\r
         jo.put("suspend", suspended);\r
-        jo.put(lastModStr, lastMod.getTime());\r
-        jo.put(createdDateStr, createdDate.getTime());\r
+        jo.put(LAST_MOD, lastMod.getTime());\r
+        jo.put(CREATED_DATE, createdDate.getTime());\r
         jo.put("aaf_instance", aafInstance);\r
         return jo;\r
     }\r
@@ -595,10 +595,10 @@ public class Feed extends Syncable {
     public JSONObject asJSONObject(boolean hidepasswords) {\r
         JSONObject jo = asJSONObject();\r
         if (hidepasswords) {\r
-            jo.remove(feedIDStr);    // we no longer hide passwords, however we do hide these\r
-            jo.remove(deletedStr);\r
-            jo.remove(lastModStr);\r
-            jo.remove(createdDateStr);\r
+            jo.remove(FEED_ID);    // we no longer hide passwords, however we do hide these\r
+            jo.remove(DEL);\r
+            jo.remove(LAST_MOD);\r
+            jo.remove(CREATED_DATE);\r
         }\r
         return jo;\r
     }\r
@@ -609,10 +609,10 @@ public class Feed extends Syncable {
      */\r
     public JSONObject asLimitedJSONObject() {\r
         JSONObject jo = asJSONObject();\r
-        jo.remove(deletedStr);\r
-        jo.remove(feedIDStr);\r
-        jo.remove(lastModStr);\r
-        jo.remove(createdDateStr);\r
+        jo.remove(DEL);\r
+        jo.remove(FEED_ID);\r
+        jo.remove(LAST_MOD);\r
+        jo.remove(CREATED_DATE);\r
         return jo;\r
     }\r
 \r