openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r880686 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema: Constraint.java LocalConstraint.java Unique.java
Date Mon, 16 Nov 2009 09:19:31 GMT
Author: ppoddar
Date: Mon Nov 16 09:19:24 2009
New Revision: 880686

URL: http://svn.apache.org/viewvc?rev=880686&view=rev
Log:
OPENJPA-1387: Remove non-nullable constraint from Unique column.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Constraint.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Unique.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Constraint.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Constraint.java?rev=880686&r1=880685&r2=880686&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Constraint.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Constraint.java
Mon Nov 16 09:19:24 2009
@@ -24,6 +24,7 @@
  *
  * @author Abe White
  */
+@SuppressWarnings("serial")
 public abstract class Constraint
     extends ReferenceCounter {
 
@@ -180,9 +181,6 @@
     public String toString() {
         if (getName() != null)
             return getName();
-
-        String name = getClass().getName();
-        name = name.substring(name.lastIndexOf('.') + 1);
-        return "<" + name.toLowerCase() + ">";
+        return "<" + getClass().getSimpleName().toLowerCase() + ">";
     }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java?rev=880686&r1=880685&r2=880686&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/LocalConstraint.java
Mon Nov 16 09:19:24 2009
@@ -21,7 +21,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.lang.ObjectUtils;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.util.InvalidStateException;
 
@@ -32,13 +31,13 @@
  *
  * @author Abe White
  */
+@SuppressWarnings("serial")
 public abstract class LocalConstraint
     extends Constraint {
 
-    private static final Localizer _loc = Localizer.forPackage
-        (LocalConstraint.class);
+    private static final Localizer _loc = Localizer.forPackage(LocalConstraint.class);
 
-    private List _colList = null;
+    private List<Column> _colList = null;
     private Column[] _cols = null;
 
     /**
@@ -99,7 +98,7 @@
                 col == null ? null : getTable()));
     	
         if (_colList == null)
-            _colList = new ArrayList(3);
+            _colList = new ArrayList<Column>(3);
         else if (_colList.contains(col))
             return;
 
@@ -124,7 +123,7 @@
     }
 
     /**
-     * Return true if the pk includes the given column.
+     * Return true if this constraint includes the given column.
      */
     public boolean containsColumn(Column col) {
         if (col == null || _colList == null)
@@ -133,7 +132,7 @@
     }
 
     /**
-     * Ref all columns in this constraint.
+     * Reference all columns in this constraint.
      */
     public void refColumns() {
         Column[] cols = getColumns();
@@ -142,7 +141,7 @@
     }
 
     /**
-     * Deref all columns in this constraint.
+     * Dereference all columns in this constraint.
      */
     public void derefColumns() {
         Column[] cols = getColumns();

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Unique.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Unique.java?rev=880686&r1=880685&r2=880686&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Unique.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Unique.java Mon
Nov 16 09:19:24 2009
@@ -24,6 +24,7 @@
  * @author Abe White
  * @author Pinaki Poddar
  */
+@SuppressWarnings("serial")
 public class Unique
     extends LocalConstraint {
 	
@@ -46,26 +47,7 @@
     }
     
     /**
-     * Adds the given column. 
-     * The added column is set to non-nullable because a unique constraint
-     * on the database requires that its constituent columns are NOT NULL. 
-     * @see Column#setNotNull(boolean)
-     */
-    public void addColumn(Column col) {
-    	super.addColumn(col);
-    	col.setNotNull(true);
-    }
-    
-    /**
-     * Set the name of the constraint. This method cannot be called if the
-     * constraint already belongs to a table. 
-     */
-    public void setName(String name) {
-        super.setName(name);
-    }
-    
-    /**
-     * Return true if the structure of this primary key matches that of
+     * Return true if the structure of this constraint matches that of
      * the given one (same table, same columns).
      */
     public boolean equalsUnique(Unique unq) {



Mime
View raw message