private final int subid;\r
private final int nodeid;\r
\r
+ /**\r
+ * EgressRoute constructor.\r
+ * @param subid subscription id\r
+ * @param nodeid node id\r
+ */\r
public EgressRoute(int subid, int nodeid) {\r
this.subid = subid;\r
this.nodeid = nodeid;\r
- // Note: unlike for Feeds, it subscriptions can be removed from the tables, so it is\r
- // possible that an orphan ERT entry can exist if a sub is removed.\r
- // if (Subscription.getSubscriptionById(subid) == null)\r
- // throw new IllegalArgumentException("No such subscription: "+subid);\r
}\r
\r
public EgressRoute(int subid, String node) {\r
* @return an EgressRoute, or null if there is no route for this subscription\r
*/\r
public static EgressRoute getEgressRoute(int sub) {\r
- EgressRoute v = null;\r
+ EgressRoute er = null;\r
DB db = new DB();\r
String sql = "select NODEID from EGRESS_ROUTES where SUBID = ?";\r
try (Connection conn = db.getConnection();\r
try (ResultSet rs = ps.executeQuery()) {\r
if (rs.next()) {\r
int node = rs.getInt("NODEID");\r
- v = new EgressRoute(sub, node);\r
+ er = new EgressRoute(sub, node);\r
}\r
} finally {\r
db.release(conn);\r
} catch (SQLException e) {\r
intlogger.error("PROV0009 EgressRoute.getEgressRoute: " + e.getMessage(), e);\r
}\r
- return v;\r
+ return er;\r
}\r
\r
@Override\r
- public boolean doDelete(Connection c) {\r
+ public boolean doDelete(Connection conn) {\r
boolean rv = true;\r
String sql = "delete from EGRESS_ROUTES where SUBID = ?";\r
- try (PreparedStatement ps = c.prepareStatement(sql)) {\r
+ try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
ps.setInt(1, subid);\r
ps.execute();\r
} catch (SQLException e) {\r
}\r
\r
@Override\r
- public boolean doInsert(Connection c) {\r
+ public boolean doInsert(Connection conn) {\r
boolean rv = false;\r
String sql = "insert into EGRESS_ROUTES (SUBID, NODEID) values (?, ?)";\r
- try (PreparedStatement ps = c.prepareStatement(sql)) {\r
+ try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
// Create the NETWORK_ROUTES row\r
ps.setInt(1, this.subid);\r
ps.setInt(2, this.nodeid);\r
ps.execute();\r
- ps.close();\r
rv = true;\r
} catch (SQLException e) {\r
intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);\r
}\r
\r
@Override\r
- public boolean doUpdate(Connection c) {\r
+ public boolean doUpdate(Connection conn) {\r
boolean rv = true;\r
String sql = "update EGRESS_ROUTES set NODEID = ? where SUBID = ?";\r
- try (PreparedStatement ps = c.prepareStatement(sql)) {\r
+ try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
ps.setInt(1, nodeid);\r
ps.setInt(2, subid);\r
ps.executeUpdate();\r
}\r
\r
@Override\r
- public int compareTo(EgressRoute o) {\r
- return this.subid - o.subid;\r
+ public int compareTo(EgressRoute er) {\r
+ return this.subid - er.subid;\r
}\r
\r
@Override\r