Commit 1d66fdb9 authored by Nate Putnam's avatar Nate Putnam Committed by nate

3.0.1

Fix group performance issue.
Improve sql code.
Remove some cruft.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12342 b35dd754-fafc-0310-a699-88a17e54d16e
parent 16cca416
......@@ -44,6 +44,12 @@
Packet Filter Plugin Changelog
</h1>
<p><b>3.0.1</b> -- May 7, 2011</p>
<li>Fix group performance issue.</li>
<li>Improve sql code.</li>
<li>Remove some cruft.</li>
<p><b>3.0</b> -- Dec 2, 2009</p>
<ul>
......@@ -71,4 +77,4 @@ Packet Filter Plugin Changelog
</body>
</html>
\ No newline at end of file
</html>
......@@ -111,7 +111,7 @@ public class PacketFilter {
private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
Group group = null;
try {
group = GroupManager.getInstance().getProvider().getGroup(rulegroup);
group = GroupManager.getInstance().getGroup(rulegroup);
} catch (GroupNotFoundException e) {
e.printStackTrace();
}
......
......@@ -230,16 +230,16 @@ public class DbRuleManager {
pstmt.setString(4, rule.getSource());
pstmt.setString(5, rule.getClass().getName());
if (rule.isDisabled()) {
pstmt.setByte(6, new Byte("1"));
pstmt.setBoolean(6, Boolean.TRUE);
}
else {
pstmt.setByte(6, new Byte("0"));
pstmt.setBoolean(6, Boolean.FALSE);
}
if (rule.doLog()) {
pstmt.setByte(7, new Byte("1"));
pstmt.setBoolean(7, Boolean.TRUE);
}
else {
pstmt.setByte(7, new Byte("0"));
pstmt.setBoolean(7, Boolean.FALSE);
}
pstmt.setString(8, rule.getDescription());
pstmt.setString(9, rule.getSourceType().toString());
......@@ -261,17 +261,17 @@ public class DbRuleManager {
}
public boolean deleteRule(String ruleId) {
public boolean deleteRule(int ruleId) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_RULE);
pstmt.setString(1, ruleId);
pstmt.setInt(1,new Integer(ruleId));
pstmt.execute();
rules.remove(getRuleById(new Integer(ruleId)));
rules.remove(getRuleById(ruleId));
} catch (SQLException sqle) {
Log.error(sqle.getMessage(), sqle);
......@@ -383,13 +383,13 @@ public class DbRuleManager {
pstmt.setString(3, rule.getSource());
pstmt.setString(4, rule.getClass().getName());
if (rule.isDisabled())
pstmt.setByte(5, new Byte("1"));
pstmt.setBoolean(5, Boolean.TRUE);
else
pstmt.setByte(5, new Byte("0"));
pstmt.setBoolean(5, Boolean.FALSE);
if (rule.doLog())
pstmt.setByte(6, new Byte("1"));
pstmt.setBoolean(6, Boolean.TRUE);
else
pstmt.setByte(6, new Byte("0"));
pstmt.setBoolean(6, Boolean.FALSE);
pstmt.setString(7, rule.getDescription());
pstmt.setInt(8, order);
......
......@@ -12,7 +12,7 @@ public interface RuleManager {
public void addRule(Rule rule);
public void deleteRule(String ruleId);
public void deleteRule(int ruleId);
public void moveOne(int srcId, int destId);
public int getLastOrder();
......
......@@ -6,10 +6,8 @@ import java.util.List;
public class RuleManagerProxy implements RuleManager {
private DbRuleManager dbRuleManager = DbRuleManager.getInstance();
//private List<Rule> rules = null;
public RuleManagerProxy() {
// rules = dbRuleManager.getRules();
}
public Rule getRuleById(int id) {
......@@ -22,30 +20,16 @@ public class RuleManagerProxy implements RuleManager {
}
public void addRule(Rule rule, Integer order) {
/*if (order != null && order.intValue() > 0) {
DbRuleManager.getInstance().addRule(rule,order);
}
rules.add(order.intValue(),rule);
*/
}
public void addRule(Rule rule) {
dbRuleManager.addRule(rule);
//rulesUpdated();
}
public void deleteRule(String ruleId) {
public void deleteRule(int ruleId) {
//Remove rule from storage (db)
dbRuleManager.deleteRule(ruleId);
//Recreate array.
/*for (Rule rule : rules) {
if (rule == null) break;
if (rule.getRuleId().equals(ruleId)) {
rules.remove(rule);
}
} */
}
public void moveOne(int srcId, int destId) {
......@@ -58,9 +42,6 @@ public class RuleManagerProxy implements RuleManager {
}
public int getLastOrder() {
//Get the last rule in the "Cache" and return it's order
//if (rules.size() == 0) return 0;
// return rules.get(rules.size()-1).getOrder();
return dbRuleManager.getLastOrderId();
}
......
......@@ -24,7 +24,7 @@
return;
}
if (delete) {
rm.deleteRule(ruleId);
rm.deleteRule(Integer.parseInt(ruleId));
response.sendRedirect("pf-main.jsp");
}
%>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment