ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r740581 [1/2] - in /ibatis/trunk/java/tools/ibator/core: build/ doc/ htmldoc/ src/org/apache/ibatis/ibator/api/ src/org/apache/ibatis/ibator/generator/ibatis2/ src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/ src/org/apache/ibatis/iba...
Date Wed, 04 Feb 2009 02:37:43 GMT
Author: jgbutler
Date: Wed Feb  4 02:37:43 2009
New Revision: 740581

URL: http://svn.apache.org/viewvc?rev=740581&view=rev
Log:
[ibator] Changes for IBATIS-577 - define SQL fragments for column lists

Added:
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BaseColumnListElementGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BlobColumnListElementGenerator.java
Modified:
    ibatis/trunk/java/tools/ibator/core/build/version.properties
    ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt
    ibatis/trunk/java/tools/ibator/core/htmldoc/whatsNew.html
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPlugin.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPluginAdapter.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/package.html
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/XmlConstants.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/SqlMapGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/AbstractXmlElementGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithBLOBsElementGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithoutBLOBsElementGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByPrimaryKeyElementGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultCommentGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorPluginAggregator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/SqlReservedWords.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/BaseIbatorRules.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRulesDelegate.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/RenameExampleClassPlugin.java
    ibatis/trunk/java/tools/ibator/core/test/org/apache/ibatis/ibator/internal/util/JavaBeansUtilTests.java

Modified: ibatis/trunk/java/tools/ibator/core/build/version.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/build/version.properties?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/build/version.properties (original)
+++ ibatis/trunk/java/tools/ibator/core/build/version.properties Wed Feb  4 02:37:43 2009
@@ -1,4 +1,4 @@
 #Ibator build version info
-#Wed Jan 07 10:10:05 CST 2009
+#Tue Feb 03 20:33:04 CST 2009
 version=1.2.2
-buildNum=700
+buildNum=703

Modified: ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt (original)
+++ ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt Wed Feb  4 02:37:43 2009
@@ -7,6 +7,8 @@
 Enhancements:
 1. IBATIS-569 - Make it easier to override IbatorRules in plugins
 2. IBATIS-571 - Added "autoDelimitKeywords" support to <ibatorContext>
+3. IBATIS-577 - Define SQL fragments for column lists.  Thanks to Iwao
+   AVE! for the idea and the initial patch
 
 -------------------------------------------------------------------------------
 Version 1.2.1:

Modified: ibatis/trunk/java/tools/ibator/core/htmldoc/whatsNew.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/htmldoc/whatsNew.html?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/htmldoc/whatsNew.html (original)
+++ ibatis/trunk/java/tools/ibator/core/htmldoc/whatsNew.html Wed Feb  4 02:37:43 2009
@@ -25,14 +25,18 @@
 <h3>Enhancements</h3>
 <ul>
   <li>IBATIS-569 - Modified the IbatorRules implementation to make it easier
-   for plugins to provide custom implementations of IbatorRules.  See the 
-   Javadoc for the new class
-   <code>org.apache.ibatis.ibator.internal.rules.IbatorRulesDelegate</code>
-   for more information.</li>
+      for plugins to provide custom implementations of IbatorRules.  See the 
+      Javadoc for the new class
+      <code>org.apache.ibatis.ibator.internal.rules.IbatorRulesDelegate</code>
+      for more information.</li>
   <li>IBATIS-571 - Added support for automatically delimiting SQL keywords
-   if they are used as column names in tables.  See the 
-   <a href="configreference/ibatorContext.html">&lt;ibatorContext&gt;</a>
page for detailed
-   for more information.</li>
+      if they are used as column names in tables.  See the 
+      <a href="configreference/ibatorContext.html">&lt;ibatorContext&gt;</a>
page for detailed
+      for more information.</li>
+  <li>IBATIS-577 - Define SQL fragments for column lists to improve
+      reusability of generated code.  Thanks to Iwao AVE! for the idea
+      and the initial patch.
+  </li>
 </ul>
 
 <h2>Version 1.2.1</h2>

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPlugin.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPlugin.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPlugin.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPlugin.java
Wed Feb  4 02:37:43 2009
@@ -919,6 +919,32 @@
     boolean sqlMapExampleWhereClauseElementGenerated(XmlElement element, IntrospectedTable
introspectedTable);
 
     /**
+     * This method is called when the baseColumnList element is generated.
+     * 
+     * @param element the generated &lt;sql&gt; element
+     * @param introspectedTable ibator's class containing information
+     *   about the table as introspected from the database
+     * @return true if the element should be generated, false
+     *   if the generated element should be ignored.  In the case
+     *   of multiple plugins, the first plugin returning false
+     *   will disable the calling of further plugins.
+     */
+    boolean sqlMapBaseColumnListElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
+
+    /**
+     * This method is called when the blobColumnList element is generated.
+     * 
+     * @param element the generated &lt;sql&gt; element
+     * @param introspectedTable ibator's class containing information
+     *   about the table as introspected from the database
+     * @return true if the element should be generated, false
+     *   if the generated element should be ignored.  In the case
+     *   of multiple plugins, the first plugin returning false
+     *   will disable the calling of further plugins.
+     */
+    boolean sqlMapBlobColumnListElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
+
+    /**
      * This method is called when the insert element is generated.
      * 
      * @param element the generated &lt;insert&gt; element

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPluginAdapter.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPluginAdapter.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPluginAdapter.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/IbatorPluginAdapter.java
Wed Feb  4 02:37:43 2009
@@ -306,4 +306,14 @@
 
     public void initialized(IntrospectedTable introspectedTable) {
     }
+
+    public boolean sqlMapBaseColumnListElementGenerated(XmlElement element,
+            IntrospectedTable introspectedTable) {
+        return true;
+    }
+
+    public boolean sqlMapBlobColumnListElementGenerated(XmlElement element,
+            IntrospectedTable introspectedTable) {
+        return true;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/package.html
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/package.html?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/package.html (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/package.html Wed
Feb  4 02:37:43 2009
@@ -1,8 +1,8 @@
 <html>
 <head>
-  <title>Package Description for Main ibator API Classes</title>
+  <title>Package Description for Main Ibator API Classes</title>
 </head>
 <body>
-<p>Provides the main classes and interfaces used by clients of ibator.</p>
+<p>Provides the main classes and interfaces used by clients of Ibator.</p>
 </body>
 </html>

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/XmlConstants.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/XmlConstants.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/XmlConstants.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/XmlConstants.java
Wed Feb  4 02:37:43 2009
@@ -115,6 +115,16 @@
         sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
         sb.append("Example_Where_Clause"); //$NON-NLS-1$
         EXAMPLE_WHERE_CLAUSE_ID = sb.toString();
+
+        sb.setLength(0);
+        sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        sb.append("Base_Column_List"); //$NON-NLS-1$
+        BASE_COLUMN_LIST_ID = sb.toString();
+
+        sb.setLength(0);
+        sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        sb.append("Blob_Column_List"); //$NON-NLS-1$
+        BLOB_COLUMN_LIST_ID = sb.toString();
     }
 
     public static final String SQL_MAP_SYSTEM_ID = "http://ibatis.apache.org/dtd/sql-map-2.dtd";
//$NON-NLS-1$
@@ -162,4 +172,8 @@
     public static final String RESULT_MAP_WITH_BLOBS_ID;
     
     public static final String EXAMPLE_WHERE_CLAUSE_ID;
+    
+    public static final String BASE_COLUMN_LIST_ID;
+    
+    public static final String BLOB_COLUMN_LIST_ID;
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/SqlMapGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/SqlMapGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/SqlMapGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/SqlMapGenerator.java
Wed Feb  4 02:37:43 2009
@@ -22,6 +22,8 @@
 import org.apache.ibatis.ibator.generator.AbstractXmlGenerator;
 import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
 import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.AbstractXmlElementGenerator;
+import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.BaseColumnListElementGenerator;
+import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.BlobColumnListElementGenerator;
 import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.CountByExampleElementGenerator;
 import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.DeleteByExampleElementGenerator;
 import org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements.DeleteByPrimaryKeyElementGenerator;
@@ -65,6 +67,8 @@
         addResultMapWithoutBLOBsElement(answer);
         addResultMapWithBLOBsElement(answer);
         addExampleWhereClauseElement(answer);
+        addBaseColumnListElement(answer);
+        addBlobColumnListElement(answer);
         addSelectByExampleWithBLOBsElement(answer);
         addSelectByExampleWithoutBLOBsElement(answer);
         addSelectByPrimaryKeyElement(answer);
@@ -104,6 +108,20 @@
         }
     }
     
+    protected void addBaseColumnListElement(XmlElement parentElement) {
+        if (introspectedTable.getRules().generateBaseColumnList()) {
+            AbstractXmlElementGenerator elementGenerator = new BaseColumnListElementGenerator();
+            initializeAndExecuteGenerator(elementGenerator, parentElement);
+        }
+    }
+    
+    protected void addBlobColumnListElement(XmlElement parentElement) {
+        if (introspectedTable.getRules().generateBlobColumnList()) {
+            AbstractXmlElementGenerator elementGenerator = new BlobColumnListElementGenerator();
+            initializeAndExecuteGenerator(elementGenerator, parentElement);
+        }
+    }
+    
     protected void addSelectByExampleWithoutBLOBsElement(XmlElement parentElement) {
         if (introspectedTable.getRules().generateSelectByExampleWithoutBLOBs()) {
             AbstractXmlElementGenerator elementGenerator = new SelectByExampleWithoutBLOBsElementGenerator();

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/AbstractXmlElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/AbstractXmlElementGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/AbstractXmlElementGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/AbstractXmlElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -15,12 +15,14 @@
  */
 package org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements;
 
+import org.apache.ibatis.ibator.api.FullyQualifiedTable;
 import org.apache.ibatis.ibator.api.IntrospectedColumn;
 import org.apache.ibatis.ibator.api.dom.xml.Attribute;
 import org.apache.ibatis.ibator.api.dom.xml.TextElement;
 import org.apache.ibatis.ibator.api.dom.xml.XmlElement;
 import org.apache.ibatis.ibator.config.GeneratedKey;
 import org.apache.ibatis.ibator.generator.AbstractGenerator;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
 import org.apache.ibatis.ibator.internal.util.StringUtility;
 
 /**
@@ -60,4 +62,18 @@
     
         return answer;
     }
+
+    protected XmlElement getBaseColumnListElement(FullyQualifiedTable table) {
+        XmlElement answer = new XmlElement("include"); //$NON-NLS-1$
+        answer.addAttribute(new Attribute("refid", //$NON-NLS-1$
+                table.getSqlMapNamespace() + "." + XmlConstants.BASE_COLUMN_LIST_ID)); //$NON-NLS-1$
+        return answer;
+    }
+
+    protected XmlElement getBlobColumnListElement(FullyQualifiedTable table) {
+        XmlElement answer = new XmlElement("include"); //$NON-NLS-1$
+        answer.addAttribute(new Attribute("refid", //$NON-NLS-1$
+                table.getSqlMapNamespace() + "." + XmlConstants.BLOB_COLUMN_LIST_ID)); //$NON-NLS-1$
+        return answer;
+    }
 }

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BaseColumnListElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BaseColumnListElementGenerator.java?rev=740581&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BaseColumnListElementGenerator.java
(added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BaseColumnListElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -0,0 +1,63 @@
+/*
+ *  Copyright 2009 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements;
+
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.xml.Attribute;
+import org.apache.ibatis.ibator.api.dom.xml.TextElement;
+import org.apache.ibatis.ibator.api.dom.xml.XmlElement;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class BaseColumnListElementGenerator extends AbstractXmlElementGenerator {
+
+    public BaseColumnListElementGenerator() {
+        super();
+    }
+
+    @Override
+    public void addElements(XmlElement parentElement) {
+        XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$
+
+        answer.addAttribute(new Attribute("id", //$NON-NLS-1$
+                XmlConstants.BASE_COLUMN_LIST_ID));
+
+        ibatorContext.getCommentGenerator().addComment(answer);
+
+        boolean comma = false;
+        StringBuilder sb = new StringBuilder();
+        
+        for (IntrospectedColumn introspectedColumn : introspectedTable.getNonBLOBColumns())
{
+            if (comma) {
+                sb.append(", "); //$NON-NLS-1$
+            } else {
+                comma = true;
+            }
+
+            sb.append(introspectedColumn.getSelectListPhrase());
+        }
+        
+        answer.addElement((new TextElement(sb.toString())));
+
+        if (ibatorContext.getPlugins().sqlMapBaseColumnListElementGenerated(answer, introspectedTable))
{
+            parentElement.addElement(answer);
+        }
+    }
+}

Added: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BlobColumnListElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BlobColumnListElementGenerator.java?rev=740581&view=auto
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BlobColumnListElementGenerator.java
(added)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/BlobColumnListElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -0,0 +1,63 @@
+/*
+ *  Copyright 2009 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements;
+
+import org.apache.ibatis.ibator.api.IntrospectedColumn;
+import org.apache.ibatis.ibator.api.dom.xml.Attribute;
+import org.apache.ibatis.ibator.api.dom.xml.TextElement;
+import org.apache.ibatis.ibator.api.dom.xml.XmlElement;
+import org.apache.ibatis.ibator.generator.ibatis2.XmlConstants;
+
+/**
+ * 
+ * @author Jeff Butler
+ *
+ */
+public class BlobColumnListElementGenerator extends AbstractXmlElementGenerator {
+
+    public BlobColumnListElementGenerator() {
+        super();
+    }
+
+    @Override
+    public void addElements(XmlElement parentElement) {
+        XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$
+
+        answer.addAttribute(new Attribute("id", //$NON-NLS-1$
+                XmlConstants.BLOB_COLUMN_LIST_ID));
+
+        ibatorContext.getCommentGenerator().addComment(answer);
+
+        boolean comma = false;
+        StringBuilder sb = new StringBuilder();
+        
+        for (IntrospectedColumn introspectedColumn : introspectedTable.getBLOBColumns())
{
+            if (comma) {
+                sb.append(", "); //$NON-NLS-1$
+            } else {
+                comma = true;
+            }
+
+            sb.append(introspectedColumn.getSelectListPhrase());
+        }
+        
+        answer.addElement((new TextElement(sb.toString())));
+
+        if (ibatorContext.getPlugins().sqlMapBlobColumnListElementGenerated(answer, introspectedTable))
{
+            parentElement.addElement(answer);
+        }
+    }
+}

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithBLOBsElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithBLOBsElementGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithBLOBsElementGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithBLOBsElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -16,7 +16,6 @@
 package org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements;
 
 import org.apache.ibatis.ibator.api.FullyQualifiedTable;
-import org.apache.ibatis.ibator.api.IntrospectedColumn;
 import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
 import org.apache.ibatis.ibator.api.dom.xml.Attribute;
 import org.apache.ibatis.ibator.api.dom.xml.TextElement;
@@ -54,25 +53,15 @@
         StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
-        boolean comma = false;
-
         if (StringUtility.stringHasValue(introspectedTable.getSelectByExampleQueryId()))
{
             sb.append('\'');
             sb.append(introspectedTable.getSelectByExampleQueryId());
-            sb.append("' as QUERYID"); //$NON-NLS-1$
-            comma = true;
-        }
-
-        for (IntrospectedColumn introspectedColumn : introspectedTable.getAllColumns()) {
-            if (comma) {
-                sb.append(", "); //$NON-NLS-1$
-            } else {
-                comma = true;
-            }
-
-            sb.append(introspectedColumn.getSelectListPhrase());
+            sb.append("' as QUERYID,"); //$NON-NLS-1$
         }
         answer.addElement(new TextElement(sb.toString()));
+        answer.addElement(getBaseColumnListElement(table));
+        answer.addElement(new TextElement(",")); //$NON-NLS-1$
+        answer.addElement(getBlobColumnListElement(table));
 
         sb.setLength(0);
         sb.append("from "); //$NON-NLS-1$

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithoutBLOBsElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithoutBLOBsElementGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithoutBLOBsElementGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByExampleWithoutBLOBsElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -16,7 +16,6 @@
 package org.apache.ibatis.ibator.generator.ibatis2.sqlmap.elements;
 
 import org.apache.ibatis.ibator.api.FullyQualifiedTable;
-import org.apache.ibatis.ibator.api.IntrospectedColumn;
 import org.apache.ibatis.ibator.api.dom.java.FullyQualifiedJavaType;
 import org.apache.ibatis.ibator.api.dom.xml.Attribute;
 import org.apache.ibatis.ibator.api.dom.xml.TextElement;
@@ -55,24 +54,13 @@
         StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
-        boolean comma = false;
         if (StringUtility.stringHasValue(introspectedTable.getSelectByExampleQueryId()))
{
             sb.append('\'');
             sb.append(introspectedTable.getSelectByExampleQueryId());
-            sb.append("' as QUERYID"); //$NON-NLS-1$
-            comma = true;
+            sb.append("' as QUERYID,"); //$NON-NLS-1$
         }
-
-        for (IntrospectedColumn introspectedColumn : introspectedTable.getNonBLOBColumns())
{
-            if (comma) {
-                sb.append(", "); //$NON-NLS-1$
-            } else {
-                comma = true;
-            }
-
-            sb.append(introspectedColumn.getSelectListPhrase());
-        }
-        answer.addElement((new TextElement(sb.toString())));
+        answer.addElement(new TextElement(sb.toString()));
+        answer.addElement(getBaseColumnListElement(table));
 
         sb.setLength(0);
         sb.append("from "); //$NON-NLS-1$

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByPrimaryKeyElementGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByPrimaryKeyElementGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByPrimaryKeyElementGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/generator/ibatis2/sqlmap/elements/SelectByPrimaryKeyElementGenerator.java
Wed Feb  4 02:37:43 2009
@@ -67,25 +67,17 @@
         StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
-        boolean comma = false;
         if (StringUtility.stringHasValue(introspectedTable.getSelectByPrimaryKeyQueryId()))
{
             sb.append('\'');
             sb.append(introspectedTable.getSelectByPrimaryKeyQueryId());
-            sb.append("' as QUERYID"); //$NON-NLS-1$
-            comma = true;
+            sb.append("' as QUERYID,"); //$NON-NLS-1$
         }
-
-        for (IntrospectedColumn introspectedColumn : introspectedTable.getAllColumns()) {
-            if (comma) {
-                sb.append(", "); //$NON-NLS-1$
-            } else {
-                comma = true;
-            }
-
-            sb.append(introspectedColumn.getSelectListPhrase());
-        }
-
         answer.addElement(new TextElement(sb.toString()));
+        answer.addElement(getBaseColumnListElement(table));
+        if (introspectedTable.hasBLOBColumns()) {
+            answer.addElement(new TextElement(",")); //$NON-NLS-1$
+            answer.addElement(getBlobColumnListElement(table));
+        }
 
         sb.setLength(0);
         sb.append("from "); //$NON-NLS-1$

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultCommentGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultCommentGenerator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultCommentGenerator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultCommentGenerator.java
Wed Feb  4 02:37:43 2009
@@ -53,7 +53,7 @@
         StringBuilder sb = new StringBuilder();
         
         field.addJavaDocLine("/**"); //$NON-NLS-1$
-        field.addJavaDocLine(" * This field was generated by Apache iBATIS ibator."); //$NON-NLS-1$
+        field.addJavaDocLine(" * This field was generated by Apache iBATIS Ibator."); //$NON-NLS-1$
         
         sb.append(" * This field corresponds to the database column "); //$NON-NLS-1$
         sb.append(table);
@@ -70,7 +70,7 @@
         StringBuilder sb = new StringBuilder();
         
         field.addJavaDocLine("/**"); //$NON-NLS-1$
-        field.addJavaDocLine(" * This field was generated by Apache iBATIS ibator."); //$NON-NLS-1$
+        field.addJavaDocLine(" * This field was generated by Apache iBATIS Ibator."); //$NON-NLS-1$
         
         sb.append(" * This field corresponds to the database table "); //$NON-NLS-1$
         sb.append(table);
@@ -85,7 +85,7 @@
         StringBuilder sb = new StringBuilder();
         
         innerClass.addJavaDocLine("/**"); //$NON-NLS-1$
-        innerClass.addJavaDocLine(" * This class was generated by Apache iBATIS ibator.");
//$NON-NLS-1$
+        innerClass.addJavaDocLine(" * This class was generated by Apache iBATIS Ibator.");
//$NON-NLS-1$
         
         sb.append(" * This class corresponds to the database table "); //$NON-NLS-1$
         sb.append(table);
@@ -100,7 +100,7 @@
         StringBuilder sb = new StringBuilder();
         
         innerEnum.addJavaDocLine("/**"); //$NON-NLS-1$
-        innerEnum.addJavaDocLine(" * This enum was generated by Apache iBATIS ibator.");
//$NON-NLS-1$
+        innerEnum.addJavaDocLine(" * This enum was generated by Apache iBATIS Ibator.");
//$NON-NLS-1$
         
         sb.append(" * This enum corresponds to the database table "); //$NON-NLS-1$
         sb.append(table);
@@ -115,7 +115,7 @@
         StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
-        method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
+        method.addJavaDocLine(" * This method was generated by Apache iBATIS Ibator."); //$NON-NLS-1$
     
         sb.append(" * This method returns the value of the database column "); //$NON-NLS-1$
         sb.append(table);
@@ -141,7 +141,7 @@
         StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
-        method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
+        method.addJavaDocLine(" * This method was generated by Apache iBATIS Ibator."); //$NON-NLS-1$
     
         sb.append(" * This method sets the value of the database column "); //$NON-NLS-1$
         sb.append(table);
@@ -170,7 +170,7 @@
         StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
-        method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
+        method.addJavaDocLine(" * This method was generated by Apache iBATIS Ibator."); //$NON-NLS-1$
         
         sb.append(" * This method corresponds to the database table "); //$NON-NLS-1$
         sb.append(table);
@@ -193,7 +193,7 @@
     public void addComment(XmlElement xmlElement) {
         xmlElement.addElement(new TextElement("<!--")); //$NON-NLS-1$
         xmlElement.addElement(new TextElement(
-                "  WARNING - This element is automatically generated by Apache iBATIS ibator,
do not modify.")); //$NON-NLS-1$
+                "  WARNING - This element is automatically generated by Apache iBATIS Ibator,
do not modify.")); //$NON-NLS-1$
 
         String s = getDateString();
         if (s != null) {

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorPluginAggregator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorPluginAggregator.java?rev=740581&r1=740580&r2=740581&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorPluginAggregator.java
(original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/IbatorPluginAggregator.java
Wed Feb  4 02:37:43 2009
@@ -950,4 +950,34 @@
             plugin.initialized(introspectedTable);
         }
     }
+
+    public boolean sqlMapBaseColumnListElementGenerated(XmlElement element,
+            IntrospectedTable introspectedTable) {
+        boolean rc = true;
+
+        for (IbatorPlugin plugin : plugins) {
+            if (!plugin
+                    .sqlMapBaseColumnListElementGenerated(element, introspectedTable)) {
+                rc = false;
+                break;
+            }
+        }
+
+        return rc;
+    }
+
+    public boolean sqlMapBlobColumnListElementGenerated(XmlElement element,
+            IntrospectedTable introspectedTable) {
+        boolean rc = true;
+
+        for (IbatorPlugin plugin : plugins) {
+            if (!plugin
+                    .sqlMapBlobColumnListElementGenerated(element, introspectedTable)) {
+                rc = false;
+                break;
+            }
+        }
+
+        return rc;
+    }
 }



Mime
View raw message