empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1375992 - in /empire-db/trunk/empire-db/src/main/java/org/apache/empire: data/Record.java data/bean/BeanRecordProxy.java db/DBRecord.java
Date Wed, 22 Aug 2012 11:18:32 GMT
Author: doebele
Date: Wed Aug 22 11:18:31 2012
New Revision: 1375992

URL: http://svn.apache.org/viewvc?rev=1375992&view=rev
Log:
EMPIREDB-163
new functin isFieldRequired()

Modified:
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/Record.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBRecord.java

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/Record.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/Record.java?rev=1375992&r1=1375991&r2=1375992&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/Record.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/Record.java Wed Aug 22
11:18:31 2012
@@ -74,6 +74,13 @@ public interface Record extends RecordDa
     Column[] getKeyColumns();    
 
     /**
+     * returns true if the field is visible to the client.
+     * @param column the column to check for visibility
+     * @return true if the field is visible to the client
+     */
+    boolean isFieldVisible(Column column);
+
+    /**
      * returns true if the field is read-only.
      * @param column the requested column
      * @return true if the field is read-only
@@ -81,11 +88,11 @@ public interface Record extends RecordDa
     boolean isFieldReadOnly(Column column);
 
     /**
-     * returns true if the field is visible to the client.
-     * @param column the column to check for visibility
-     * @return true if the field is visible to the client
+     * returns true if the field is required.
+     * @param column the requested column
+     * @return true if the field is required
      */
-    boolean isFieldVisible(Column column);
+    boolean isFieldRequired(Column column);
 
     /**
      * returns the Options list for the given record field.

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java?rev=1375992&r1=1375991&r2=1375992&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
(original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/bean/BeanRecordProxy.java
Wed Aug 22 11:18:31 2012
@@ -155,6 +155,11 @@ public class BeanRecordProxy<T> implemen
         return column.getOptions();
     }
 
+    public boolean isFieldVisible(Column column)
+    {
+        return true;
+    }
+
     public boolean isFieldReadOnly(Column column)
     {
     	if (isNew()==false && ObjectUtils.contains(keyColumns, column))
@@ -164,9 +169,9 @@ public class BeanRecordProxy<T> implemen
         return column.isReadOnly();
     }
 
-    public boolean isFieldVisible(Column column)
+    public boolean isFieldRequired(Column column)
     {
-        return true;
+        return column.isRequired();
     }
 
     public boolean isModified()

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBRecord.java?rev=1375992&r1=1375991&r2=1375992&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBRecord.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBRecord.java Wed Aug 22
11:18:31 2012
@@ -551,50 +551,55 @@ public class DBRecord extends DBRecordDa
     }
     
     /**
-     * returns whether a field is read only or not
-     * 
-     * @param column the database column 
-     * 
-     * @return true if the field is read only
-     */
-    public boolean isFieldReadOnly(DBColumn column)
-    {
-        if (rowset==null)
-            throw new ObjectNotValidException(this);
-        // Ask RowSet
-        return (rowset.isColumnReadOnly(column));
-    }
-    
-    /**
-     * returns whether a field is read only or not
-     */
-    public final boolean isFieldReadOnly(Column column)
-    {
-        return isFieldReadOnly((DBColumn)column);
-    }
-    
-    /**
      * returns whether a field is visible to the client or not
      * <P>
      * May be overridden to implement context specific logic.
      * @param column the column which to check for visibility
      * @return true if the column is visible or false if not 
      */
-    public boolean isFieldVisible(DBColumn column)
+    public boolean isFieldVisible(Column column)
     {
         if (rowset==null)
             throw new ObjectNotValidException(this);
         // Check if field is present and the value is valid 
         int index = rowset.getColumnIndex(column);
+    	if (index<0)
+            throw new InvalidArgumentException("column", column);
         return (index>=0 && isValueValid(index));
     }
     
     /**
      * returns whether a field is read only or not
+     * 
+     * @param column the database column 
+     * 
+     * @return true if the field is read only
+     */
+    public boolean isFieldReadOnly(Column column)
+    {
+        if (rowset==null)
+            throw new ObjectNotValidException(this);
+    	if (rowset.getColumnIndex(column)<0)
+            throw new InvalidArgumentException("column", column);
+        // Ask RowSet
+        return (rowset.isColumnReadOnly((DBColumn)column));
+    }
+    
+    /**
+     * returns whether a field is required or not
+     * 
+     * @param column the database column 
+     * 
+     * @return true if the field is required
      */
-    public final boolean isFieldVisible(Column column)
+    public boolean isFieldRequired(Column column)
     {
-        return isFieldVisible((DBColumn)column);
+        if (rowset==null)
+            throw new ObjectNotValidException(this);
+    	if (rowset.getColumnIndex(column)<0)
+            throw new InvalidArgumentException("column", column);
+        // from column definition
+        return (column.isRequired());
     }
 
     /**



Mime
View raw message