svn commit: r949606 - /ofbiz/trunk/framework/sql/src/org/ofbiz/sql/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r949606 - /ofbiz/trunk/framework/sql/src/org/ofbiz/sql/

doogie-3
Author: doogie
Date: Sun May 30 22:06:53 2010
New Revision: 949606

URL: http://svn.apache.org/viewvc?rev=949606&view=rev
Log:
Implement equals() in a bunch of places.

Modified:
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Atom.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BetweenCondition.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BooleanCondition.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ConditionList.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/CountFunction.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldAll.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldDef.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldValue.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FunctionCall.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertRow.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertValues.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ListCondition.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/MathValue.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/NumberValue.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/OrderByItem.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ParameterValue.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SetField.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/StringValue.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Table.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/TableName.java

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Atom.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Atom.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Atom.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Atom.java Sun May 30 22:06:53 2010
@@ -19,8 +19,13 @@
 package org.ofbiz.sql;
 
 import org.ofbiz.base.lang.Appender;
+import org.ofbiz.base.util.UtilObject;
 
 public abstract class Atom implements Appender<StringBuilder> {
+    public static boolean equalsHelper(Object l, Object r) {
+        return UtilObject.equalsHelper(l, r);
+    }
+
     public String toString() {
         return appendTo(new StringBuilder()).toString();
     }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BetweenCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BetweenCondition.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BetweenCondition.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BetweenCondition.java Sun May 30 22:06:53 2010
@@ -45,6 +45,15 @@ public final class BetweenCondition exte
         return r2;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof BetweenCondition) {
+            BetweenCondition other = (BetweenCondition) o;
+            return left.equals(other.left) && r1.equals(other.r1) && r2.equals(other.r2);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         left.appendTo(sb);
         sb.append(" BETWEEN ");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BooleanCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BooleanCondition.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BooleanCondition.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/BooleanCondition.java Sun May 30 22:06:53 2010
@@ -45,6 +45,15 @@ public final class BooleanCondition exte
         return right;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof BooleanCondition) {
+            BooleanCondition other = (BooleanCondition) o;
+            return left.equals(other.left) & op.equals(other.op) && right.equals(other.right);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         left.appendTo(sb);
         sb.append(' ').append(op).append(' ');

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ConditionList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ConditionList.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ConditionList.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ConditionList.java Sun May 30 22:06:53 2010
@@ -48,6 +48,15 @@ public final class ConditionList extends
         return conditions.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof ConditionList) {
+            ConditionList other = (ConditionList) o;
+            return joiner.equals(other.joiner) && conditions.equals(other.conditions);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append('(');
         StringUtil.appendTo(sb, conditions, " ", " ", joiner.toString());

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/CountFunction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/CountFunction.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/CountFunction.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/CountFunction.java Sun May 30 22:06:53 2010
@@ -43,6 +43,15 @@ public final class CountFunction extends
         return field;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof CountFunction) {
+            CountFunction other = (CountFunction) o;
+            return isDistinct == other.isDistinct && field.equals(other.field);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("COUNT(");
         if (isDistinct) sb.append("DISTINCT ");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldAll.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldAll.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldAll.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldAll.java Sun May 30 22:06:53 2010
@@ -40,6 +40,15 @@ public final class FieldAll extends Atom
         return exclude.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof FieldAll) {
+            FieldAll other = (FieldAll) o;
+            return alias.equals(other.alias) && exclude.equals(other.exclude);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append(alias).append(".*");
         if (!exclude.isEmpty()) {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldDef.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldDef.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldDef.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldDef.java Sun May 30 22:06:53 2010
@@ -35,6 +35,15 @@ public final class FieldDef extends Atom
         return value;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof FieldDef) {
+            FieldDef other = (FieldDef) o;
+            return alias.equals(other.alias) && value.equals(other.value);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         value.appendTo(sb);
         sb.append(" AS ").append(alias);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldValue.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldValue.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FieldValue.java Sun May 30 22:06:53 2010
@@ -47,6 +47,15 @@ public final class FieldValue extends St
         return fieldName;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof FieldValue) {
+            FieldValue other = (FieldValue) o;
+            return fieldName.equals(other.fieldName) && equalsHelper(tableName, other.tableName);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         if (tableName != null) {
             sb.append(tableName).append('.');

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FunctionCall.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FunctionCall.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FunctionCall.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/FunctionCall.java Sun May 30 22:06:53 2010
@@ -52,6 +52,15 @@ public final class FunctionCall extends
         return values.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof FunctionCall) {
+            FunctionCall other = (FunctionCall) o;
+            return name.equals(other.name) && values.equals(other.values);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append(name).append('(');
         StringUtil.appendTo(sb, values, null, null, ", ");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertRow.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertRow.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertRow.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertRow.java Sun May 30 22:06:53 2010
@@ -34,6 +34,15 @@ public final class InsertRow extends Ato
         return values.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof InsertRow) {
+            InsertRow other = (InsertRow) o;
+            return values.equals(other.values);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append('(');
         StringUtil.appendTo(sb, values, null, null, ", ");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertValues.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertValues.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertValues.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/InsertValues.java Sun May 30 22:06:53 2010
@@ -34,6 +34,15 @@ public final class InsertValues extends
         return rows.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof InsertValues) {
+            InsertValues other = (InsertValues) o;
+            return rows.equals(other.rows);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("VALUES ");
         StringUtil.appendTo(sb, rows, null, null, ", ");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Joined.java Sun May 30 22:06:53 2010
@@ -54,6 +54,15 @@ public final class Joined extends Atom i
         return joined;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof Joined) {
+            Joined other = (Joined) o;
+            return tableName.equals(other.tableName) && keyMaps.equals(other.keyMaps) && equalsHelper(joined, other.joined);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         return appendTo("left", sb);
     }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/KeyMap.java Sun May 30 22:06:53 2010
@@ -35,6 +35,15 @@ public final class KeyMap extends Atom {
         return rightFieldName;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof KeyMap) {
+            KeyMap other = (KeyMap) o;
+            return leftFieldName.equals(other.leftFieldName) && rightFieldName.equals(other.rightFieldName);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         return appendTo("left", "right", sb);
     }

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ListCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ListCondition.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ListCondition.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ListCondition.java Sun May 30 22:06:53 2010
@@ -49,6 +49,15 @@ public final class ListCondition extends
         return values;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof ListCondition) {
+            ListCondition other = (ListCondition) o;
+            return left.equals(other.left) && op.equals(other.op) && values.equals(other.values);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         left.appendTo(sb);
         sb.append(' ').append(op).append(" (");

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/MathValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/MathValue.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/MathValue.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/MathValue.java Sun May 30 22:06:53 2010
@@ -48,6 +48,15 @@ public final class MathValue extends Sta
         return values.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof MathValue) {
+            MathValue other = (MathValue) o;
+            return op.equals(other.op) && values.equals(other.values);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append('(');
         StringUtil.appendTo(sb, values, " ", null, op);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/NumberValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/NumberValue.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/NumberValue.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/NumberValue.java Sun May 30 22:06:53 2010
@@ -33,6 +33,15 @@ public final class NumberValue<N extends
         return number;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof NumberValue) {
+            NumberValue other = (NumberValue) o;
+            return number.equals(other.number);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append(number);
         return sb;

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/OrderByItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/OrderByItem.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/OrderByItem.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/OrderByItem.java Sun May 30 22:06:53 2010
@@ -43,6 +43,15 @@ public final class OrderByItem extends A
         return fieldName;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof OrderByItem) {
+            OrderByItem other = (OrderByItem) o;
+            return order.equals(other.order) && equalsHelper(functionName, other.functionName) && fieldName.equals(other.fieldName);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         if (functionName != null) sb.append(functionName).append('(');
         sb.append(fieldName);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ParameterValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ParameterValue.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ParameterValue.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/ParameterValue.java Sun May 30 22:06:53 2010
@@ -33,6 +33,15 @@ public final class ParameterValue extend
         return name;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof ParameterValue) {
+            ParameterValue other = (ParameterValue) o;
+            return name.equals(other.name);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append('?').append(name);
         return sb;

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Relation.java Sun May 30 22:06:53 2010
@@ -56,6 +56,15 @@ public final class Relation extends Atom
         return keyMaps.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof Relation) {
+            Relation other = (Relation) o;
+            return equalsHelper(type, other.type) && equalsHelper(title, other.title) && entityName.equals(other.entityName) && keyMaps.equals(other.keyMaps);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("RELATION");
         if (type != null) {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLDelete.java Sun May 30 22:06:53 2010
@@ -39,6 +39,15 @@ public final class SQLDelete extends SQL
         return whereCondition;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof SQLDelete) {
+            SQLDelete other = (SQLDelete) o;
+            return table.equals(other.table) && equalsHelper(whereCondition, other.whereCondition);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("DELETE FROM ");
         table.getTableName().appendTo(sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java Sun May 30 22:06:53 2010
@@ -51,6 +51,15 @@ public final class SQLInsert extends SQL
         return columns.iterator();
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof SQLInsert) {
+            SQLInsert other = (SQLInsert) o;
+            return tableName.equals(other.tableName) && equalsHelper(columns, other.columns) && source.equals(other.source);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("INSERT INTO ");
         tableName.appendTo(sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLSelect.java Sun May 30 22:06:53 2010
@@ -101,6 +101,26 @@ public final class SQLSelect extends SQL
         return limit;
     }
 
+    public boolean equals(Object o) {
+        if (!(o instanceof SQLSelect)) {
+            return false;
+        }
+
+        SQLSelect other = (SQLSelect) o;
+        return isDistinct == other.isDistinct
+            && fieldAlls.equals(other.fieldAlls)
+            && fieldDefs.equals(other.fieldDefs)
+            && table.equals(other.table)
+            && relations.equals(other.relations)
+            && equalsHelper(whereCondition, other.whereCondition)
+            && equalsHelper(havingCondition, other.havingCondition)
+            && offset == other.offset
+            && limit == other.limit
+            && equalsHelper(groupBy, other.groupBy)
+            && equalsHelper(orderBy, other.orderBy)
+        ;
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("SELECT");
         if (isDistinct) {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLUpdate.java Sun May 30 22:06:53 2010
@@ -50,6 +50,15 @@ public final class SQLUpdate extends SQL
         return whereCondition;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof SQLUpdate) {
+            SQLUpdate other = (SQLUpdate) o;
+            return table.equals(other.table) && setFields.equals(other.setFields) && equalsHelper(whereCondition, other.whereCondition);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("UPDATE ");
         table.getTableName().appendTo(sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLView.java Sun May 30 22:06:53 2010
@@ -39,6 +39,15 @@ public final class SQLView extends SQLSt
         return sqlSelect;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof SQLView) {
+            SQLView other = (SQLView) o;
+            return name.equals(other.name) && sqlSelect.equals(other.sqlSelect);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("CREATE VIEW ").append(name).append(" AS ");
         sqlSelect.appendTo(sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SetField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SetField.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SetField.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SetField.java Sun May 30 22:06:53 2010
@@ -35,6 +35,15 @@ public final class SetField extends Atom
         return value;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof SetField) {
+            SetField other = (SetField) o;
+            return name.equals(other.name) && value.equals(other.value);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append(name).append(" = ");
         value.appendTo(sb);

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/StringValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/StringValue.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/StringValue.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/StringValue.java Sun May 30 22:06:53 2010
@@ -33,6 +33,15 @@ public final class StringValue extends C
         return str;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof StringValue) {
+            StringValue other = (StringValue) o;
+            return str.equals(other.str);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append('\'').append(str.replaceAll("'", "''")).append('\'');
         return sb;

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Table.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Table.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Table.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Table.java Sun May 30 22:06:53 2010
@@ -39,6 +39,15 @@ public final class Table extends Atom {
         return joined;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof Table) {
+            Table other = (Table) o;
+            return tableName.equals(other.tableName) && equalsHelper(joined, other.joined);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         tableName.appendTo(sb);
         if (joined != null) {

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/TableName.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/TableName.java?rev=949606&r1=949605&r2=949606&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/TableName.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/TableName.java Sun May 30 22:06:53 2010
@@ -35,6 +35,15 @@ public final class TableName extends Ato
         return alias;
     }
 
+    public boolean equals(Object o) {
+        if (o instanceof TableName) {
+            TableName other = (TableName) o;
+            return tableName.equals(other.tableName) && alias.equals(other.alias);
+        } else {
+            return false;
+        }
+    }
+
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append(tableName);
         if (!alias.equals(tableName)) {