Code style cleanup for prov authz and beans
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / onap / dmaap / datarouter / provisioning / beans / Feed.java
index 3462e23..a8be6b3 100644 (file)
@@ -26,6 +26,19 @@ package org.onap.dmaap.datarouter.provisioning.beans;
 \r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
+import java.io.InvalidObjectException;\r
+import java.sql.Connection;\r
+import java.sql.PreparedStatement;\r
+import java.sql.ResultSet;\r
+import java.sql.SQLException;\r
+import java.sql.Statement;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Date;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Set;\r
 import org.json.JSONArray;\r
 import org.json.JSONException;\r
 import org.json.JSONObject;\r
@@ -33,10 +46,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB;
 import org.onap.dmaap.datarouter.provisioning.utils.JSONUtilities;\r
 import org.onap.dmaap.datarouter.provisioning.utils.URLUtilities;\r
 \r
-import java.io.InvalidObjectException;\r
-import java.sql.*;\r
-import java.util.Date;\r
-import java.util.*;\r
+\r
 \r
 /**\r
  * The representation of a Feed.  Feeds can be retrieved from the DB, or stored/updated in the DB.\r
@@ -45,6 +55,7 @@ import java.util.*;
  * @version $Id: Feed.java,v 1.13 2013/10/28 18:06:52 eby Exp $\r
  */\r
 public class Feed extends Syncable {\r
+\r
     private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
     private static int next_feedid = getMaxFeedID() + 1;\r
     private static final String SQLEXCEPTION = "SQLException: ";\r
@@ -54,15 +65,15 @@ public class Feed extends Syncable {
     private String name;\r
     private String version;\r
     private String description;\r
-    private String business_description; // New field is added - Groups feature Rally:US708102 - 1610\r
+    private String businessDescription; // New field is added - Groups feature Rally:US708102 - 1610\r
     private FeedAuthorization authorization;\r
     private String publisher;\r
     private FeedLinks links;\r
     private boolean deleted;\r
     private boolean suspended;\r
-    private Date last_mod;\r
-    private Date created_date;\r
-    private String aaf_instance;\r
+    private Date lastMod;\r
+    private Date createdDate;\r
+    private String aafInstance;\r
 \r
     /**\r
      * Check if a feed ID is valid.\r
@@ -76,9 +87,9 @@ public class Feed extends Syncable {
         try {\r
             DB db = new DB();\r
             Connection conn = db.getConnection();\r
-            try(PreparedStatement stmt = conn.prepareStatement("select COUNT(*) from FEEDS where FEEDID = ?")) {\r
+            try (PreparedStatement stmt = conn.prepareStatement("select COUNT(*) from FEEDS where FEEDID = ?")) {\r
                 stmt.setInt(1, id);\r
-                try(ResultSet rs = stmt.executeQuery()) {\r
+                try (ResultSet rs = stmt.executeQuery()) {\r
                     if (rs.next()) {\r
                         count = rs.getInt(1);\r
                     }\r
@@ -125,9 +136,8 @@ public class Feed extends Syncable {
         int count = 0;\r
         try {\r
             DB db = new DB();\r
-            @SuppressWarnings("resource")\r
-            Connection conn = db.getConnection();\r
-            try(Statement stmt = conn.createStatement()) {\r
+            @SuppressWarnings("resource") Connection conn = db.getConnection();\r
+            try (Statement stmt = conn.createStatement()) {\r
                 try (ResultSet rs = stmt.executeQuery("select count(*) from FEEDS where DELETED = 0")) {\r
                     if (rs.next()) {\r
                         count = rs.getInt(1);\r
@@ -141,13 +151,17 @@ public class Feed extends Syncable {
         return count;\r
     }\r
 \r
+    /**\r
+     * Method to get max feed id.\r
+     * @return int max feed id\r
+     */\r
     public static int getMaxFeedID() {\r
         int max = 0;\r
         try {\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-            try(Statement stmt = conn.createStatement()) {\r
+            try (Statement stmt = conn.createStatement()) {\r
                 try (ResultSet rs = stmt.executeQuery("select MAX(feedid) from FEEDS")) {\r
                     if (rs.next()) {\r
                         max = rs.getInt(1);\r
@@ -161,14 +175,18 @@ public class Feed extends Syncable {
         return max;\r
     }\r
 \r
+    /**\r
+     * Gets all feeds.\r
+     * @return Collection of feeds\r
+     */\r
     public static Collection<Feed> getAllFeeds() {\r
         Map<Integer, Feed> map = new HashMap<>();\r
         try {\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-            try(Statement stmt = conn.createStatement()) {\r
-                try(ResultSet rs = stmt.executeQuery("select * from FEEDS")) {\r
+            try (Statement stmt = conn.createStatement()) {\r
+                try (ResultSet rs = stmt.executeQuery("select * from FEEDS")) {\r
                     while (rs.next()) {\r
                         Feed feed = new Feed(rs);\r
                         map.put(feed.getFeedid(), feed);\r
@@ -176,7 +194,7 @@ public class Feed extends Syncable {
                 }\r
 \r
                 String sql = "select * from FEED_ENDPOINT_IDS";\r
-                try(ResultSet rs = stmt.executeQuery(sql)){\r
+                try (ResultSet rs = stmt.executeQuery(sql)) {\r
                     while (rs.next()) {\r
                         int id = rs.getInt("FEEDID");\r
                         Feed feed = map.get(id);\r
@@ -189,7 +207,7 @@ public class Feed extends Syncable {
                 }\r
 \r
                 sql = "select * from FEED_ENDPOINT_ADDRS";\r
-                try(ResultSet rs = stmt.executeQuery(sql)) {\r
+                try (ResultSet rs = stmt.executeQuery(sql)) {\r
                     while (rs.next()) {\r
                         int id = rs.getInt("FEEDID");\r
                         Feed feed = map.get(id);\r
@@ -207,6 +225,12 @@ public class Feed extends Syncable {
         return map.values();\r
     }\r
 \r
+    /**\r
+     * Get Feed URL list.\r
+     * @param name of Feed\r
+     * @param val of feed\r
+     * @return List of feed names\r
+     */\r
     public static List<String> getFilteredFeedUrlList(final String name, final String val) {\r
         List<String> list = new ArrayList<>();\r
         String sql = "select SELF_LINK from FEEDS where DELETED = 0";\r
@@ -215,22 +239,23 @@ public class Feed extends Syncable {
         } else if (name.equals("publ")) {\r
             sql += " and PUBLISHER = ?";\r
         } else if (name.equals("subs")) {\r
-            sql = "select distinct FEEDS.SELF_LINK from FEEDS, SUBSCRIPTIONS " +\r
-                    "where DELETED = 0 " +\r
-                    "and FEEDS.FEEDID = SUBSCRIPTIONS.FEEDID " +\r
-                    "and SUBSCRIPTIONS.SUBSCRIBER = ?";\r
+            sql = "select distinct FEEDS.SELF_LINK from FEEDS, SUBSCRIPTIONS "\r
+                          + "where DELETED = 0 "\r
+                          + "and FEEDS.FEEDID = SUBSCRIPTIONS.FEEDID "\r
+                          + "and SUBSCRIPTIONS.SUBSCRIBER = ?";\r
         }\r
         try {\r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
             Connection conn = db.getConnection();\r
-            try(PreparedStatement ps = conn.prepareStatement(sql)) {\r
-                if (sql.indexOf('?') >= 0)\r
+            try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
+                if (sql.indexOf('?') >= 0) {\r
                     ps.setString(1, val);\r
-                try(ResultSet rs = ps.executeQuery()) {\r
+                }\r
+                try (ResultSet rs = ps.executeQuery()) {\r
                     while (rs.next()) {\r
-                        String t = rs.getString(1);\r
-                        list.add(t.trim());\r
+                        String str = rs.getString(1);\r
+                        list.add(str.trim());\r
                     }\r
                 }\r
             }\r
@@ -282,30 +307,44 @@ public class Feed extends Syncable {
         this("", "", "", "");\r
     }\r
 \r
-    public Feed(String name, String version, String desc, String business_description) {\r
+    /**\r
+     * Feed constructor.\r
+     * @param name feed name\r
+     * @param version feed version\r
+     * @param desc feed description\r
+     * @param businessDescription feed business description\r
+     */\r
+    public Feed(String name, String version, String desc, String businessDescription) {\r
         this.feedid = -1;\r
         this.groupid = -1; //New field is added - Groups feature Rally:US708115 - 1610\r
         this.name = name;\r
         this.version = version;\r
         this.description = desc;\r
-        this.business_description = business_description; // New field is added - Groups feature Rally:US708102 - 1610\r
+        this.businessDescription = businessDescription; // New field is added - Groups feature Rally:US708102 - 1610\r
         this.authorization = new FeedAuthorization();\r
         this.publisher = "";\r
         this.links = new FeedLinks();\r
         this.deleted = false;\r
         this.suspended = false;\r
-        this.last_mod = new Date();\r
-        this.created_date = new Date();\r
-        this.aaf_instance = "";\r
+        this.lastMod = new Date();\r
+        this.createdDate = new Date();\r
+        this.aafInstance = "";\r
     }\r
 \r
+    /**\r
+     * Feed Constructor from ResultSet.\r
+     * @param rs ResultSet\r
+     * @throws SQLException in case of SQL statement error\r
+     */\r
     public Feed(ResultSet rs) throws SQLException {\r
         this.feedid = rs.getInt("FEEDID");\r
-        this.groupid = rs.getInt("GROUPID"); //New field is added - Groups feature Rally:US708115 - 1610\r
+        //New field is added - Groups feature Rally:US708115 - 1610\r
+        this.groupid = rs.getInt("GROUPID");\r
         this.name = rs.getString("NAME");\r
         this.version = rs.getString("VERSION");\r
         this.description = rs.getString("DESCRIPTION");\r
-        this.business_description = rs.getString("BUSINESS_DESCRIPTION"); // New field is added - Groups feature Rally:US708102 - 1610\r
+        // New field is added - Groups feature Rally:US708102 - 1610\r
+        this.businessDescription = rs.getString("BUSINESS_DESCRIPTION");\r
         this.authorization = new FeedAuthorization();\r
         this.authorization.setClassification(rs.getString("AUTH_CLASS"));\r
         this.publisher = rs.getString("PUBLISHER");\r
@@ -316,11 +355,16 @@ public class Feed extends Syncable {
         this.links.setLog(rs.getString("LOG_LINK"));\r
         this.deleted = rs.getBoolean("DELETED");\r
         this.suspended = rs.getBoolean("SUSPENDED");\r
-        this.last_mod = rs.getDate("LAST_MOD");\r
-        this.created_date = rs.getTimestamp("CREATED_DATE");\r
-        this.aaf_instance = rs.getString("AAF_INSTANCE");\r
+        this.lastMod = rs.getDate("LAST_MOD");\r
+        this.createdDate = rs.getTimestamp("CREATED_DATE");\r
+        this.aafInstance = rs.getString("AAF_INSTANCE");\r
     }\r
 \r
+    /**\r
+     * Feed constructor from JSONObject.\r
+     * @param jo JSONObject\r
+     * @throws InvalidObjectException in case of JSON error\r
+     */\r
     public Feed(JSONObject jo) throws InvalidObjectException {\r
         this("", "", "", "");\r
         try {\r
@@ -328,48 +372,58 @@ public class Feed extends Syncable {
             this.feedid = jo.optInt("feedid", -1);\r
             this.groupid = jo.optInt("groupid");\r
             this.name = jo.getString("name");\r
-            this.aaf_instance = jo.optString("aaf_instance", "legacy");\r
-            if(!(aaf_instance.equalsIgnoreCase("legacy")) && aaf_instance.length() > 255){\r
-                    throw new InvalidObjectException("aaf_instance field is too long");\r
+            this.aafInstance = jo.optString("aaf_instance", "legacy");\r
+            if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
+                throw new InvalidObjectException("aaf_instance field is too long");\r
             }\r
-            if (name.length() > 255)\r
+            if (name.length() > 255) {\r
                 throw new InvalidObjectException("name field is too long");\r
+            }\r
             try {\r
                 this.version = jo.getString("version");\r
             } catch (JSONException e) {\r
                 intlogger.warn("PROV0023 Feed.Feed: " + e.getMessage(), e);\r
                 this.version = null;\r
             }\r
-            if(version != null && version.length() > 20)\r
+            if (version != null && version.length() > 20) {\r
                 throw new InvalidObjectException("version field is too long");\r
+            }\r
             this.description = jo.optString("description");\r
-            this.business_description = jo.optString("business_description");\r
-            if (description.length() > 1000)\r
+            this.businessDescription = jo.optString("business_description");\r
+            if (description.length() > 1000) {\r
                 throw new InvalidObjectException("technical description field is too long");\r
-            if (business_description.length() > 1000)\r
+            }\r
+            if (businessDescription.length() > 1000) {\r
                 throw new InvalidObjectException("business description field is too long");\r
+            }\r
             this.authorization = new FeedAuthorization();\r
             JSONObject jauth = jo.getJSONObject("authorization");\r
             this.authorization.setClassification(jauth.getString("classification"));\r
-            if (this.authorization.getClassification().length() > 32)\r
+            if (this.authorization.getClassification().length() > 32) {\r
                 throw new InvalidObjectException("classification field is too long");\r
+            }\r
             JSONArray endPointIds = jauth.getJSONArray("endpoint_ids");\r
             for (int i = 0; i < endPointIds.length(); i++) {\r
                 JSONObject id = endPointIds.getJSONObject(i);\r
                 FeedEndpointID fid = new FeedEndpointID(id.getString("id"), id.getString("password"));\r
-                if (fid.getId().length() > 60)\r
+                if (fid.getId().length() > 60) {\r
                     throw new InvalidObjectException("id field is too long (" + fid.getId() + ")");\r
-                if (fid.getPassword().length() > 32)\r
-                    throw new InvalidObjectException("password field is too long ("+ fid.getPassword()+")");  //Fortify scan fixes - Privacy Violation\r
+                }\r
+                if (fid.getPassword().length() > 32) {\r
+                    //Fortify scan fixes - Privacy Violation\r
+                    throw new InvalidObjectException("password field is too long (" + fid.getPassword() + ")");\r
+                }\r
                 this.authorization.getEndpoint_ids().add(fid);\r
             }\r
-            if (this.authorization.getEndpoint_ids().isEmpty())\r
+            if (this.authorization.getEndpoint_ids().isEmpty()) {\r
                 throw new InvalidObjectException("need to specify at least one endpoint_id");\r
+            }\r
             endPointIds = jauth.getJSONArray("endpoint_addrs");\r
             for (int i = 0; i < endPointIds.length(); i++) {\r
                 String addr = endPointIds.getString(i);\r
-                if (!JSONUtilities.validIPAddrOrSubnet(addr))\r
+                if (!JSONUtilities.validIPAddrOrSubnet(addr)) {\r
                     throw new InvalidObjectException("bad IP addr or subnet mask: " + addr);\r
+                }\r
                 this.authorization.getEndpoint_addrs().add(addr);\r
             }\r
 \r
@@ -390,6 +444,10 @@ public class Feed extends Syncable {
         return feedid;\r
     }\r
 \r
+    /**\r
+     *  Set feedid with FeedLinks.\r
+      * @param feedid Feedid to set to\r
+     */\r
     public void setFeedid(int feedid) {\r
         this.feedid = feedid;\r
 \r
@@ -402,11 +460,11 @@ public class Feed extends Syncable {
     }\r
 \r
     public String getAafInstance() {\r
-        return aaf_instance;\r
+        return aafInstance;\r
     }\r
 \r
-    public void setAaf_instance(String aaf_instance) {\r
-        this.aaf_instance = aaf_instance;\r
+    public void setAaf_instance(String aafInstance) {\r
+        this.aafInstance = aafInstance;\r
     }\r
 \r
     //new getter setters for groups- Rally:US708115 - 1610\r
@@ -444,11 +502,11 @@ public class Feed extends Syncable {
 \r
     // New field is added - Groups feature Rally:US708102 - 1610\r
     public String getBusiness_description() {\r
-        return business_description;\r
+        return businessDescription;\r
     }\r
 \r
-    public void setBusiness_description(String business_description) {\r
-        this.business_description = business_description;\r
+    public void setBusiness_description(String businessDescription) {\r
+        this.businessDescription = businessDescription;\r
     }\r
 \r
     public FeedAuthorization getAuthorization() {\r
@@ -463,10 +521,15 @@ public class Feed extends Syncable {
         return publisher;\r
     }\r
 \r
+    /**\r
+     * Set publisher.\r
+     * @param publisher Publisher name\r
+     */\r
     public void setPublisher(String publisher) {\r
         if (publisher != null) {\r
-            if (publisher.length() > 8)\r
+            if (publisher.length() > 8) {\r
                 publisher = publisher.substring(0, 8);\r
+            }\r
             this.publisher = publisher;\r
         }\r
     }\r
@@ -499,31 +562,29 @@ public class Feed extends Syncable {
     public JSONObject asJSONObject() {\r
         JSONObject jo = new JSONObject();\r
         jo.put("feedid", feedid);\r
-        jo.put("groupid", groupid); //New field is added - Groups feature Rally:US708115 - 1610\r
+        //New field is added - Groups feature Rally:US708115 - 1610\r
+        jo.put("groupid", groupid);\r
         jo.put("name", name);\r
         jo.put("version", version);\r
         jo.put("description", description);\r
-        jo.put("business_description", business_description); // New field is added - Groups feature Rally:US708102 - 1610\r
+        // New field is added - Groups feature Rally:US708102 - 1610\r
+        jo.put("business_description", businessDescription);\r
         jo.put("authorization", authorization.asJSONObject());\r
         jo.put("publisher", publisher);\r
         jo.put("links", links.asJSONObject());\r
         jo.put("deleted", deleted);\r
         jo.put("suspend", suspended);\r
-        jo.put("last_mod", last_mod.getTime());\r
-        jo.put("created_date", created_date.getTime());\r
-        jo.put("aaf_instance", aaf_instance);\r
-        return jo;\r
-    }\r
-\r
-    public JSONObject asLimitedJSONObject() {\r
-        JSONObject jo = asJSONObject();\r
-        jo.remove("deleted");\r
-        jo.remove("feedid");\r
-        jo.remove("last_mod");\r
-        jo.remove("created_date");\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
 \r
+    /**\r
+     * Method to hide some attributes.\r
+     * @param hidepasswords true/false\r
+     * @return JSONObject\r
+     */\r
     public JSONObject asJSONObject(boolean hidepasswords) {\r
         JSONObject jo = asJSONObject();\r
         if (hidepasswords) {\r
@@ -535,13 +596,28 @@ public class Feed extends Syncable {
         return jo;\r
     }\r
 \r
+    /**\r
+     * Method to limit JSONObject.\r
+     * @return JSONObject\r
+     */\r
+    public JSONObject asLimitedJSONObject() {\r
+        JSONObject jo = asJSONObject();\r
+        jo.remove("deleted");\r
+        jo.remove("feedid");\r
+        jo.remove("last_mod");\r
+        jo.remove("created_date");\r
+        return jo;\r
+    }\r
+\r
+\r
+\r
     @Override\r
-    public boolean doDelete(Connection c) {\r
+    public boolean doDelete(Connection conn) {\r
         boolean rv = true;\r
         PreparedStatement ps = null;\r
         try {\r
             String sql = "delete from FEEDS where FEEDID = ?";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             ps.setInt(1, feedid);\r
             ps.execute();\r
         } catch (SQLException e) {\r
@@ -549,7 +625,7 @@ public class Feed extends Syncable {
             intlogger.error("PROV0007 doDelete: " + e.getMessage(), e);\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -560,20 +636,21 @@ public class Feed extends Syncable {
     }\r
 \r
     @Override\r
-    public synchronized boolean doInsert(Connection c) {\r
+    public synchronized boolean doInsert(Connection conn) {\r
         boolean rv = true;\r
         try {\r
             if (feedid == -1) {\r
                 setFeedid(next_feedid++);\r
             }\r
             // In case we insert a feed from synchronization\r
-            if (feedid > next_feedid)\r
+            if (feedid > next_feedid) {\r
                 next_feedid = feedid + 1;\r
+            }\r
 \r
             // Create FEED_ENDPOINT_IDS rows\r
             FeedAuthorization auth = getAuthorization();\r
             String sql = "insert into FEED_ENDPOINT_IDS values (?, ?, ?)";\r
-            try(PreparedStatement ps2 = c.prepareStatement(sql)) {\r
+            try (PreparedStatement ps2 = conn.prepareStatement(sql)) {\r
                 for (FeedEndpointID fid : auth.getEndpoint_ids()) {\r
                     ps2.setInt(1, feedid);\r
                     ps2.setString(2, fid.getId());\r
@@ -584,7 +661,7 @@ public class Feed extends Syncable {
 \r
             // Create FEED_ENDPOINT_ADDRS rows\r
             sql = "insert into FEED_ENDPOINT_ADDRS values (?, ?)";\r
-            try(PreparedStatement ps2 = c.prepareStatement(sql)) {\r
+            try (PreparedStatement ps2 = conn.prepareStatement(sql)) {\r
                 for (String t : auth.getEndpoint_addrs()) {\r
                     ps2.setInt(1, feedid);\r
                     ps2.setString(2, t);\r
@@ -593,8 +670,11 @@ public class Feed extends Syncable {
             }\r
 \r
             // Finally, create the FEEDS row\r
-            sql = "insert into FEEDS (FEEDID, NAME, VERSION, DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, DELETED, SUSPENDED,BUSINESS_DESCRIPTION, GROUPID, AAF_INSTANCE) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
-            try(PreparedStatement ps2 = c.prepareStatement(sql)) {\r
+            sql = "insert into FEEDS (FEEDID, NAME, VERSION, DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, "\r
+                          + "PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, DELETED, SUSPENDED,"\r
+                          + "BUSINESS_DESCRIPTION, GROUPID, AAF_INSTANCE) "\r
+                          + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
+            try (PreparedStatement ps2 = conn.prepareStatement(sql)) {\r
                 ps2.setInt(1, feedid);\r
                 ps2.setString(2, getName());\r
                 ps2.setString(3, getVersion());\r
@@ -620,7 +700,7 @@ public class Feed extends Syncable {
     }\r
 \r
     @Override\r
-    public boolean doUpdate(Connection c) {\r
+    public boolean doUpdate(Connection conn) {\r
         boolean rv = true;\r
         Feed oldobj = getFeedById(feedid);\r
         PreparedStatement ps = null;\r
@@ -630,7 +710,7 @@ public class Feed extends Syncable {
 \r
             // Insert new FEED_ENDPOINT_IDS rows\r
             String sql = "insert into FEED_ENDPOINT_IDS values (?, ?, ?)";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             for (FeedEndpointID fid : newset) {\r
                 if (!oldset.contains(fid)) {\r
                     ps.setInt(1, feedid);\r
@@ -643,7 +723,7 @@ public class Feed extends Syncable {
 \r
             // Delete old FEED_ENDPOINT_IDS rows\r
             sql = "delete from FEED_ENDPOINT_IDS where FEEDID = ? AND USERID = ? AND PASSWORD = ?";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             for (FeedEndpointID fid : oldset) {\r
                 if (!newset.contains(fid)) {\r
                     ps.setInt(1, feedid);\r
@@ -658,7 +738,7 @@ public class Feed extends Syncable {
             Set<String> newset2 = getAuthorization().getEndpoint_addrs();\r
             Set<String> oldset2 = oldobj.getAuthorization().getEndpoint_addrs();\r
             sql = "insert into FEED_ENDPOINT_ADDRS values (?, ?)";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             for (String t : newset2) {\r
                 if (!oldset2.contains(t)) {\r
                     ps.setInt(1, feedid);\r
@@ -670,7 +750,7 @@ public class Feed extends Syncable {
 \r
             // Delete old FEED_ENDPOINT_ADDRS rows\r
             sql = "delete from FEED_ENDPOINT_ADDRS where FEEDID = ? AND ADDR = ?";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             for (String t : oldset2) {\r
                 if (!newset2.contains(t)) {\r
                     ps.setInt(1, feedid);\r
@@ -681,8 +761,9 @@ public class Feed extends Syncable {
             ps.close();\r
 \r
             // Finally, update the FEEDS row\r
-            sql = "update FEEDS set DESCRIPTION = ?, AUTH_CLASS = ?, DELETED = ?, SUSPENDED = ?, BUSINESS_DESCRIPTION=?, GROUPID=? where FEEDID = ?";\r
-            ps = c.prepareStatement(sql);\r
+            sql = "update FEEDS set DESCRIPTION = ?, AUTH_CLASS = ?, DELETED = ?, SUSPENDED = ?, "\r
+                          + "BUSINESS_DESCRIPTION=?, GROUPID=? where FEEDID = ?";\r
+            ps = conn.prepareStatement(sql);\r
             ps.setString(1, getDescription());\r
             ps.setString(2, getAuthorization().getClassification());\r
             ps.setInt(3, deleted ? 1 : 0);\r
@@ -697,8 +778,9 @@ public class Feed extends Syncable {
             intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);\r
         } finally {\r
             try {\r
-                if (ps != null)\r
+                if (ps != null) {\r
                     ps.close();\r
+                }\r
             } catch (SQLException e) {\r
                 intlogger.error(SQLEXCEPTION + e.getMessage(), e);\r
             }\r
@@ -707,7 +789,7 @@ public class Feed extends Syncable {
     }\r
 \r
     /**\r
-     * Rally US708115\r
+     * Rally US708115.\r
      * Change Ownership of FEED - 1610\r
      */\r
     public boolean changeOwnerShip() {\r
@@ -717,9 +799,9 @@ public class Feed extends Syncable {
 \r
             DB db = new DB();\r
             @SuppressWarnings("resource")\r
-            Connection c = db.getConnection();\r
+            Connection conn = db.getConnection();\r
             String sql = "update FEEDS set PUBLISHER = ? where FEEDID = ?";\r
-            ps = c.prepareStatement(sql);\r
+            ps = conn.prepareStatement(sql);\r
             ps.setString(1, this.publisher);\r
             ps.setInt(2, feedid);\r
             ps.execute();\r
@@ -729,7 +811,7 @@ public class Feed extends Syncable {
             intlogger.warn("PROV0008 changeOwnerShip: " + e.getMessage(), e);\r
         } finally {\r
             try {\r
-                if(ps!=null) {\r
+                if (ps != null) {\r
                     ps.close();\r
                 }\r
             } catch (SQLException e) {\r
@@ -747,33 +829,48 @@ public class Feed extends Syncable {
 \r
     @Override\r
     public boolean equals(Object obj) {\r
-        if (!(obj instanceof Feed))\r
+        if (!(obj instanceof Feed)) {\r
             return false;\r
+        }\r
         Feed of = (Feed) obj;\r
-        if (feedid != of.feedid)\r
+        if (feedid != of.feedid) {\r
             return false;\r
-        if (groupid != of.groupid) //New field is added - Groups feature Rally:US708115 - 1610\r
+        }\r
+        if (groupid != of.groupid) {\r
+            //New field is added - Groups feature Rally:US708115 - 1610\r
             return false;\r
-        if (!name.equals(of.name))\r
+        }\r
+        if (!name.equals(of.name)) {\r
             return false;\r
-        if (!version.equals(of.version))\r
+        }\r
+        if (!version.equals(of.version)) {\r
             return false;\r
-        if (!description.equals(of.description))\r
+        }\r
+        if (!description.equals(of.description)) {\r
             return false;\r
-        if (!business_description.equals(of.business_description)) // New field is added - Groups feature Rally:US708102 - 1610\r
+        }\r
+        if (!businessDescription.equals(of.businessDescription)) {\r
+            // New field is added - Groups feature Rally:US708102 - 1610\r
             return false;\r
-        if (!publisher.equals(of.publisher))\r
+        }\r
+        if (!publisher.equals(of.publisher)) {\r
             return false;\r
-        if (!authorization.equals(of.authorization))\r
+        }\r
+        if (!authorization.equals(of.authorization)) {\r
             return false;\r
-        if (!links.equals(of.links))\r
+        }\r
+        if (!links.equals(of.links)) {\r
             return false;\r
-        if (deleted != of.deleted)\r
+        }\r
+        if (deleted != of.deleted) {\r
             return false;\r
-        if (suspended != of.suspended)\r
+        }\r
+        if (suspended != of.suspended) {\r
             return false;\r
-        if (!aaf_instance.equals(of.aaf_instance))\r
+        }\r
+        if (!aafInstance.equals(of.aafInstance)) {\r
             return false;\r
+        }\r
         return true;\r
     }\r
 \r