]> source.dussan.org Git - iciql.git/commitdiff
Eliminate redundant methods
authorJames Moger <james.moger@gmail.com>
Mon, 15 Oct 2012 14:50:32 +0000 (10:50 -0400)
committerJames Moger <james.moger@gmail.com>
Mon, 15 Oct 2012 14:50:32 +0000 (10:50 -0400)
src/com/iciql/TableDefinition.java

index c348295bcabd79726555210923a93a6e861ca1c7..a2b4f366e326bb8e995dbfa35f77ca90c6d5a1cc 100644 (file)
@@ -346,34 +346,10 @@ public class TableDefinition<T> {
                        ConstraintDeferrabilityType deferrabilityType) {\r
                List<String> columnNames = mapColumnNames(modelFields);\r
                List<String> referenceColumnNames = mapColumnNames(refModelFields);\r
-               addForeignKey(name, columnNames, refTableName, referenceColumnNames,\r
+               addConstraintForeignKey(name, columnNames, refTableName, referenceColumnNames,\r
                                deleteType, updateType, deferrabilityType);\r
        }\r
 \r
-       /**\r
-        * Defines a foreign key constraint.\r
-        * \r
-        * @param name\r
-        * @param columnNames\r
-        */\r
-       private void addForeignKey(String name, List<String> columnNames, String referenceTableName, \r
-                       List<String> referenceColumnNames, ConstraintDeleteType deleteType, \r
-                       ConstraintUpdateType updateType, ConstraintDeferrabilityType deferrabilityType) {\r
-               ConstraintForeignKeyDefinition constraint = new ConstraintForeignKeyDefinition();\r
-               if (StringUtils.isNullOrEmpty(name)) {\r
-                       constraint.constraintName = tableName + "_" + constraintsUnique.size();\r
-               } else {\r
-                       constraint.constraintName = name;\r
-               }\r
-               constraint.foreignColumns = Utils.newArrayList(columnNames);\r
-               constraint.referenceTable = referenceTableName;\r
-               constraint.referenceColumns = Utils.newArrayList(referenceColumnNames);\r
-               constraint.deleteType = deleteType;\r
-               constraint.updateType = updateType;\r
-               constraint.deferrabilityType = deferrabilityType;\r
-               constraintsForeignKey.add(constraint);\r
-       }\r
-       \r
        void defineColumnName(Object column, String columnName) {\r
                FieldDefinition def = fieldMap.get(column);\r
                if (def != null) {\r
@@ -1082,12 +1058,12 @@ public class TableDefinition<T> {
        private void addConstraintForeignKey(IQContraintForeignKey constraint) {\r
                List<String> foreignColumns = Arrays.asList(constraint.foreignColumns());\r
                List<String> referenceColumns = Arrays.asList(constraint.referenceColumns());\r
-               addContraintForeignKey(constraint.name(), foreignColumns, constraint.referenceName(), referenceColumns, constraint.deleteType(), constraint.updateType(), constraint.deferrabilityType());\r
+               addConstraintForeignKey(constraint.name(), foreignColumns, constraint.referenceName(), referenceColumns, constraint.deleteType(), constraint.updateType(), constraint.deferrabilityType());\r
        }\r
        \r
        private void addConstraintUnique(IQContraintUnique constraint) {\r
                List<String> uniqueColumns = Arrays.asList(constraint.uniqueColumns());\r
-               addContraintUnique(constraint.name(), uniqueColumns);\r
+               addConstraintUnique(constraint.name(), uniqueColumns);\r
        }\r
        \r
        /**\r
@@ -1108,7 +1084,7 @@ public class TableDefinition<T> {
         * @param deferrabilityType\r
         *            deferrability mode\r
         */\r
-       private void addContraintForeignKey(String name,\r
+       private void addConstraintForeignKey(String name,\r
                        List<String> foreignColumns, String referenceName,\r
                        List<String> referenceColumns, ConstraintDeleteType deleteType,\r
                        ConstraintUpdateType updateType, ConstraintDeferrabilityType deferrabilityType) {\r
@@ -1127,25 +1103,6 @@ public class TableDefinition<T> {
                constraintsForeignKey.add(constraint);\r
        }\r
 \r
-       /**\r
-        * Defines a unique constraint with the specified parameters.\r
-        * \r
-        * @param name\r
-        *            name of the constraint\r
-        * @param uniqueColumns\r
-        *            list of columns declared as unique\r
-        */\r
-       private void addContraintUnique(String name, List<String> uniqueColumns) {\r
-               ConstraintUniqueDefinition constraint = new ConstraintUniqueDefinition();\r
-               if (StringUtils.isNullOrEmpty(name)) {\r
-                       constraint.constraintName = tableName + "_" + constraintsUnique.size();\r
-               } else {\r
-                       constraint.constraintName = name;\r
-               }\r
-               constraint.uniqueColumns = Utils.newArrayList(uniqueColumns);\r
-               constraintsUnique.add(constraint);\r
-       }\r
-\r
        private void addIndex(IQIndex index) {\r
                List<String> columns = Arrays.asList(index.value());\r
                addIndex(index.name(), index.type(), columns);\r