empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1375739 - in /empire-db/trunk: empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/ empire-db/src/main/java/org/apache/empire/data/ empire-db/src/main/java/org/apache/empire/db/
Date Tue, 21 Aug 2012 19:49:19 GMT
Author: doebele
Date: Tue Aug 21 19:49:19 2012
New Revision: 1375739

URL: http://svn.apache.org/viewvc?rev=1375739&view=rev
Log:
EMPIREDB-157 
Provide Grouping for DataType

Modified:
    empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/DataType.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBColumn.java
    empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java

Modified: empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java?rev=1375739&r1=1375738&r2=1375739&view=diff
==============================================================================
--- empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
(original)
+++ empire-db/trunk/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
Tue Aug 21 19:49:19 2012
@@ -38,7 +38,6 @@ import org.apache.empire.data.Column;
 import org.apache.empire.data.DataType;
 import org.apache.empire.exceptions.InternalException;
 import org.apache.empire.exceptions.UnexpectedReturnValueException;
-import org.apache.empire.jsf2.controls.InputControl.InputInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/DataType.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/DataType.java?rev=1375739&r1=1375738&r2=1375739&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/DataType.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/data/DataType.java Tue Aug 21
19:49:19 2012
@@ -88,5 +88,41 @@ public enum DataType
     /**
      * Unique Identifier (non-numeric, treated like text) 
      */
-    UNIQUEID, //     = 12;
+    UNIQUEID; //     = 12;
+    
+    /**
+     * Returns true if the data type is a text based data type (char, text or clob)
+     * @return true if the data type is a character based data type
+     */
+    public boolean isText()
+    {
+        return (this==DataType.TEXT || this==DataType.CHAR || this==DataType.CLOB);
+    }
+
+    /**
+     * Returns true if the data type is a numeric data type (integer, decimal, float)
+     * @return true if the data type is a numeric data type
+     */
+    public boolean isNumeric()
+    {
+        return (this==DataType.INTEGER || this==DataType.DECIMAL || this==DataType.FLOAT
|| this==DataType.AUTOINC);
+    }
+
+    /**
+     * Returns true if the data type is a date based data type (date or datetime)
+     * @return true if the data type is a date based data type
+     */
+    public boolean isDate()
+    {
+        return (this==DataType.DATE || this==DataType.DATETIME);
+    }
+
+    /**
+     * Returns true if the data type is a boolean type
+     * @return true if the data type is a boolean type
+     */
+    public boolean isBoolean()
+    {
+        return (this==DataType.BOOL);
+    }
 }

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBColumn.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBColumn.java?rev=1375739&r1=1375738&r2=1375739&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBColumn.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBColumn.java Tue Aug 21
19:49:19 2012
@@ -245,50 +245,6 @@ public abstract class DBColumn extends D
     {
         validate(value);
     }
-
-    /**
-     * Returns true if column the column is a character based column (char, text or clob)
-     * 
-     * @return true if column is a character based column
-     */
-    public boolean isTextColumn()
-    {
-        DataType type = getDataType();
-        return (type==DataType.TEXT || type==DataType.CHAR || type==DataType.CLOB);
-    }
-
-    /**
-     * Returns true if column the column is a numeric column (integer, decimal, float)
-     * 
-     * @return true if column is a numeric column
-     */
-    public boolean isNumericColumn()
-    {
-        DataType type = getDataType();
-        return (type==DataType.INTEGER || type==DataType.DECIMAL || type==DataType.FLOAT
|| type==DataType.AUTOINC);
-    }
-
-    /**
-     * Returns true if column the column is a date based column (date or datetime)
-     * 
-     * @return true if column is a date based column
-     */
-    public boolean isDateColumn()
-    {
-        DataType type = getDataType();
-        return (type==DataType.DATE || type==DataType.DATETIME);
-    }
-
-    /**
-     * Returns true if column the column is a large object (LOB) column
-     * 
-     * @return true if column is a large object column
-     */
-    public boolean isLOBColumn()
-    {
-        DataType type = getDataType();
-        return (type==DataType.CLOB || type==DataType.BLOB);
-    }
     
     @Override
     public abstract Element addXml(Element parent, long flags);

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java?rev=1375739&r1=1375738&r2=1375739&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java Tue Aug
21 19:49:19 2012
@@ -190,7 +190,7 @@ public class DBTableColumn extends DBCol
         // Negative size?
         if (size<0)
         {   // For Text-Columns set attribute "SINGLEBYTECHARS"
-            if (isTextColumn())
+            if (getDataType().isText())
             {
                 setAttribute(DBCOLATTR_SINGLEBYTECHARS, Boolean.TRUE);
             }    
@@ -247,7 +247,7 @@ public class DBTableColumn extends DBCol
      */
     public void setSingleByteChars(boolean singleByteChars)
     {
-        if (!isTextColumn())
+        if (!getDataType().isText())
             throw new NotSupportedException(this, "setSingleByteChars");
         // set single byte
         setAttribute(DBCOLATTR_SINGLEBYTECHARS, singleByteChars);



Mime
View raw message