ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r679231 [1/2] - in /ibatis/trunk/java/tools/ibator/core: build/ doc/ src/org/apache/ibatis/ibator/api/ src/org/apache/ibatis/ibator/api/dom/ src/org/apache/ibatis/ibator/api/dom/java/ src/org/apache/ibatis/ibator/api/dom/xml/ src/org/apache...
Date Wed, 23 Jul 2008 23:29:11 GMT
Author: jgbutler
Date: Wed Jul 23 16:29:10 2008
New Revision: 679231

URL: http://svn.apache.org/viewvc?rev=679231&view=rev
Log:
ibator: Add insertSelective method

Modified:
    ibatis/trunk/java/tools/ibator/core/build/build.xml
    ibatis/trunk/java/tools/ibator/core/build/version.properties
    ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/DAOMethodNameCalculator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/Ibator.java
    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/dom/OutputUtilities.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Field.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/FullyQualifiedJavaType.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerClass.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerEnum.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Interface.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaElement.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaWildcardType.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Method.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelClass.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelEnumeration.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Attribute.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Document.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/TextElement.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/XmlElement.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/DefaultDAOMethodNameCalculator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultShellCallback.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/ExtendedDAOMethodNameCalculator.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/ColumnDefinition.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/IntrospectedTableDefaultImpl.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/dao/BaseDAOGenerator.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.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/sqlmap/SqlMapGeneratorIterateImpl.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/JavaBeansUtil.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/EqualsHashCodePlugin.java
    ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/plugins/SqlMapConfigPlugin.java
    ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/CreateDB.sql
    ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/execute/conditional/java2/InsertTests.java
    ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/execute/flat/java2/FlatJava2Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava2/ibatortest/java2/execute/hierarchical/java2/HierarchicalJava2Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/CreateDB.sql
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/conditional/java2/ConditionalJava2Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/conditional/java5/ConditionalJava5Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/flat/java2/FlatJava2Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/flat/java5/FlatJava5Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/hierarchical/java2/HierarchicalJava2Tests.java
    ibatis/trunk/java/tools/ibator/core/testJava5/ibatortest/execute/hierarchical/java5/HierarchicalJava5Tests.java

Modified: ibatis/trunk/java/tools/ibator/core/build/build.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/build/build.xml?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/build/build.xml (original)
+++ ibatis/trunk/java/tools/ibator/core/build/build.xml Wed Jul 23 16:29:10 2008
@@ -401,7 +401,7 @@
       <fileset dir="${reports.junit}">
         <include name="TEST-*.xml"/>
       </fileset>
-	      <report format="frames" todir="${reports.junit}"/>
+      <report format="frames" todir="${reports.junit}"/>
     </junitreport>
   </target>
 	

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=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/build/version.properties (original)
+++ ibatis/trunk/java/tools/ibator/core/build/version.properties Wed Jul 23 16:29:10 2008
@@ -1,4 +1,4 @@
 #ibator build version info
-#Mon Jul 21 20:40:21 CDT 2008
+#Wed Jul 23 17:01:53 CDT 2008
 version=1.2.0
-buildNum=570
+buildNum=577

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=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt (original)
+++ ibatis/trunk/java/tools/ibator/core/doc/ReleaseNotes.txt Wed Jul 23 16:29:10 2008
@@ -4,6 +4,7 @@
 Bugs:
 1. Fixed the JavaTypeResolver so that an unsupported data type can be
    overridden by configuration.
+2. Fixed IBATIS-523 - bug in EqualsHashCodePlugin
 
 Enhancements:
 1. Ibator now includes a plugin machanism that you can use to extend or
@@ -17,6 +18,7 @@
    patch!
 3. Added abiliy to configure an implementation of IntrospectedTable interface.
    This to allow overriding of many default behaviors of ibator.
+4. New method - insertSelective
    
    
 Changes:

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/DAOMethodNameCalculator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/DAOMethodNameCalculator.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/DAOMethodNameCalculator.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/DAOMethodNameCalculator.java Wed Jul 23 16:29:10 2008
@@ -34,6 +34,14 @@
     String getInsertMethodName(IntrospectedTable introspectedTable);
     
     /**
+     * Calculates and returns a name for the insert selective method.
+     * 
+     * @param introspectedTable
+     * @return the calculated name
+     */
+    String getInsertSelectiveMethodName(IntrospectedTable introspectedTable);
+    
+    /**
      * Calculates and returns a name for the update by primary key without BLOBs
      * method.
      * 

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/FullyQualifiedTable.java Wed Jul 23 16:29:10 2008
@@ -140,7 +140,7 @@
 	}
 
     public String getFullyQualifiedTableNameAtRuntime() {
-        StringBuffer localCatalog = new StringBuffer();
+        StringBuilder localCatalog = new StringBuilder();
         if (!ignoreQualifiersAtRuntime) {
             if (StringUtility.stringHasValue(runtimeCatalog)) {
                 localCatalog.append(runtimeCatalog);
@@ -152,7 +152,7 @@
             addDelimiters(localCatalog);
         }
         
-        StringBuffer localSchema = new StringBuffer();
+        StringBuilder localSchema = new StringBuilder();
         if (!ignoreQualifiersAtRuntime) {
             if (StringUtility.stringHasValue(runtimeSchema)) {
                 localSchema.append(runtimeSchema);
@@ -164,7 +164,7 @@
             addDelimiters(localSchema);
         }
         
-        StringBuffer localTableName = new StringBuffer();
+        StringBuilder localTableName = new StringBuilder();
         if (StringUtility.stringHasValue(runtimeTableName)) {
             localTableName.append(runtimeTableName);
         } else {
@@ -180,7 +180,7 @@
     }
 
     public String getAliasedFullyQualifiedTableNameAtRuntime() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append(getFullyQualifiedTableNameAtRuntime());
         
@@ -268,7 +268,7 @@
      * @return the subpackage for this table
      */
     public String getSubPackage() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         if (!ignoreQualifiersAtRuntime) {
             if (StringUtility.stringHasValue(runtimeCatalog)) {
                 sb.append('.');
@@ -291,7 +291,7 @@
         return sb.toString();
     }
     
-    private void addDelimiters(StringBuffer sb) {
+    private void addDelimiters(StringBuilder sb) {
         if (StringUtility.stringHasValue(beginningDelimiter)) {
             sb.insert(0, beginningDelimiter);
         }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/Ibator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/Ibator.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/Ibator.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/Ibator.java Wed Jul 23 16:29:10 2008
@@ -287,7 +287,7 @@
         File answer = null;
         
         // try up to 1000 times to generate a unique file name
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 1; i < 1000; i++) {
             sb.setLength(0);
             sb.append(fileName);

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=679231&r1=679230&r2=679231&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 Jul 23 16:29:10 2008
@@ -241,6 +241,23 @@
     boolean daoInsertMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
     
     /**
+     * This method is called when the insert selective method has been
+     * generated in the DAO implementation class.
+     * 
+     * @param method the generated insert method
+     * @param topLevelClass the partially implemented DAO implementation
+     *   class.  You can add additional imported classes to the 
+     *   implementation class if necessary.
+     * @param introspectedTable ibator's class containing information
+     *   about the table as introspected from the database
+     * @return true if the method should be generated, false
+     *   if the generated method should be ignored.  In the case
+     *   of multiple plugins, the first plugin returning false
+     *   will disable the calling of further plugins.
+     */
+    boolean daoInsertSelectiveMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable);
+    
+    /**
      * This method is called when the selectByExampleWithBLOBs method has been
      * generated in the DAO implementation class.
      * 
@@ -462,6 +479,23 @@
     boolean daoInsertMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable);
     
     /**
+     * This method is called when the insert selective method has been
+     * generated in the DAO interface class.
+     * 
+     * @param method the generated insert method
+     * @param interfaze the partially implemented DAO interface
+     *   class.  You can add additional imported classes to the 
+     *   interface class if necessary.
+     * @param introspectedTable ibator's class containing information
+     *   about the table as introspected from the database
+     * @return true if the method should be generated, false
+     *   if the generated method should be ignored.  In the case
+     *   of multiple plugins, the first plugin returning false
+     *   will disable the calling of further plugins.
+     */
+    boolean daoInsertSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable);
+    
+    /**
      * This method is called when the selectByExampleWithBLOBs method has been
      * generated in the DAO interface class.
      * 
@@ -863,6 +897,19 @@
     boolean sqlMapInsertElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
 
     /**
+     * This method is called when the insert selective element is generated.
+     * 
+     * @param element the generated &lt;insert&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 sqlMapInsertSelectiveElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
+
+    /**
      * This method is called when the resultMap with BLOBs element is
      * generated - this resultMap will extend the base resultMap.
      * 

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=679231&r1=679230&r2=679231&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 Jul 23 16:29:10 2008
@@ -289,4 +289,16 @@
     public boolean sqlMapUpdateByPrimaryKeyWithoutBLOBsElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
         return true;
     }
+
+    public boolean sqlMapInsertSelectiveElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
+        return true;
+    }
+
+    public boolean daoInsertSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
+        return true;
+    }
+
+    public boolean daoInsertSelectiveMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
+        return true;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/OutputUtilities.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/OutputUtilities.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/OutputUtilities.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/OutputUtilities.java Wed Jul 23 16:29:10 2008
@@ -41,11 +41,11 @@
      * (four spaces per indent level).
      * 
      * @param sb
-     *            a StringBuffer to append to
+     *            a StringBuilder to append to
      * @param indentLevel
      *            the required indent level
      */
-    public static void javaIndent(StringBuffer sb, int indentLevel) {
+    public static void javaIndent(StringBuilder sb, int indentLevel) {
         for (int i = 0; i < indentLevel; i++) {
             sb.append("    "); //$NON-NLS-1$
         }
@@ -56,23 +56,23 @@
      * (two spaces per indent level).
      * 
      * @param sb
-     *            a StringBuffer to append to
+     *            a StringBuilder to append to
      * @param indentLevel
      *            the required indent level
      */
-    public static void xmlIndent(StringBuffer sb, int indentLevel) {
+    public static void xmlIndent(StringBuilder sb, int indentLevel) {
         for (int i = 0; i < indentLevel; i++) {
             sb.append("  "); //$NON-NLS-1$
         }
     }
 
     /**
-     * Utility method. Adds a newline character to a StringBuffer.
+     * Utility method. Adds a newline character to a StringBuilder.
      * 
      * @param sb
-     *            the StringBuffer to be appended to
+     *            the StringBuilder to be appended to
      */
-    public static void newLine(StringBuffer sb) {
+    public static void newLine(StringBuilder sb) {
         sb.append(lineSeparator);
     }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Field.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Field.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Field.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Field.java Wed Jul 23 16:29:10 2008
@@ -76,7 +76,7 @@
     }
     
     public String getFormattedContent(int indentLevel) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         addFormattedJavadoc(sb, indentLevel);
         addFormattedAnnotations(sb, indentLevel);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/FullyQualifiedJavaType.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/FullyQualifiedJavaType.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/FullyQualifiedJavaType.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/FullyQualifiedJavaType.java Wed Jul 23 16:29:10 2008
@@ -258,7 +258,7 @@
     public void addTypeArgument(FullyQualifiedJavaType type) {
         typeArguments.add(type);
         
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(baseShortName);
         sb.append('<');
         

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerClass.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerClass.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerClass.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerClass.java Wed Jul 23 16:29:10 2008
@@ -102,7 +102,7 @@
     }
     
     public String getFormattedContent(int indentLevel) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         addFormattedJavadoc(sb, indentLevel);
         addFormattedAnnotations(sb, indentLevel);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerEnum.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerEnum.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerEnum.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/InnerEnum.java Wed Jul 23 16:29:10 2008
@@ -99,7 +99,7 @@
     }
     
     public String getFormattedContent(int indentLevel) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         addFormattedJavadoc(sb, indentLevel);
         addFormattedAnnotations(sb, indentLevel);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Interface.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Interface.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Interface.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Interface.java Wed Jul 23 16:29:10 2008
@@ -64,7 +64,7 @@
     }
 
     public String getFormattedContent() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         for (String commentLine : fileCommentLines) {
             sb.append(commentLine);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaElement.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaElement.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaElement.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaElement.java Wed Jul 23 16:29:10 2008
@@ -81,7 +81,7 @@
         addAnnotation("@SuppressWarnings(\"unchecked\")"); //$NON-NLS-1$
     }
     
-    public void addFormattedJavadoc(StringBuffer sb, int indentLevel) {
+    public void addFormattedJavadoc(StringBuilder sb, int indentLevel) {
         for (String javaDocLine : javaDocLines) {
             OutputUtilities.javaIndent(sb, indentLevel);
             sb.append(javaDocLine);
@@ -89,7 +89,7 @@
         }
     }
 
-    public void addFormattedAnnotations(StringBuffer sb, int indentLevel) {
+    public void addFormattedAnnotations(StringBuilder sb, int indentLevel) {
         for (String annotation : annotations) {
             OutputUtilities.javaIndent(sb, indentLevel);
             sb.append(annotation);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaWildcardType.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaWildcardType.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaWildcardType.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/JavaWildcardType.java Wed Jul 23 16:29:10 2008
@@ -37,7 +37,7 @@
 
     @Override
     public String getShortName() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         if (extendsType) {
             sb.append("? extends "); //$NON-NLS-1$
         } else {

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Method.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Method.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Method.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/Method.java Wed Jul 23 16:29:10 2008
@@ -73,7 +73,7 @@
     }
     
     public String getFormattedContent(int indentLevel, boolean interfaceMethod) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         addFormattedJavadoc(sb, indentLevel);
         addFormattedAnnotations(sb, indentLevel);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelClass.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelClass.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelClass.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelClass.java Wed Jul 23 16:29:10 2008
@@ -56,7 +56,7 @@
     }
 
     public String getFormattedContent() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         for (String fileCommentLine : fileCommentLines) {
             sb.append(fileCommentLine);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelEnumeration.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelEnumeration.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelEnumeration.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/java/TopLevelEnumeration.java Wed Jul 23 16:29:10 2008
@@ -47,7 +47,7 @@
      * @see org.apache.ibatis.ibator.api.dom.java.CompilationUnit#getFormattedContent()
      */
     public String getFormattedContent() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         for (String fileCommentLine : fileCommentLines) {
             sb.append(fileCommentLine);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Attribute.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Attribute.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Attribute.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Attribute.java Wed Jul 23 16:29:10 2008
@@ -45,7 +45,7 @@
     }
     
     public String getFormattedContent() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(name);
         sb.append("=\""); //$NON-NLS-1$
         sb.append(value);

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Document.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Document.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Document.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/Document.java Wed Jul 23 16:29:10 2008
@@ -66,7 +66,7 @@
     }
     
     public String getFormattedContent() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); //$NON-NLS-1$
 

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/TextElement.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/TextElement.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/TextElement.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/TextElement.java Wed Jul 23 16:29:10 2008
@@ -61,7 +61,7 @@
     private static String formatLongString(String s, int maxLineLength,
             int indentLevel) {
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         OutputUtilities.xmlIndent(sb, indentLevel);
         sb.append(s);
         if (sb.length() <= maxLineLength || s.indexOf(' ') == -1) {

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/XmlElement.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/XmlElement.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/XmlElement.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/api/dom/xml/XmlElement.java Wed Jul 23 16:29:10 2008
@@ -80,7 +80,7 @@
      */
     @Override
     public String getFormattedContent(int indentLevel) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         OutputUtilities.xmlIndent(sb, indentLevel);
         sb.append('<');

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=679231&r1=679230&r2=679231&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 Jul 23 16:29:10 2008
@@ -50,7 +50,7 @@
     }
 
     public void addFieldComment(Field field, FullyQualifiedTable table, String columnName) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         field.addJavaDocLine("/**"); //$NON-NLS-1$
         field.addJavaDocLine(" * This field was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -67,7 +67,7 @@
     }
     
     public void addFieldComment(Field field, FullyQualifiedTable table) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         field.addJavaDocLine("/**"); //$NON-NLS-1$
         field.addJavaDocLine(" * This field was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -82,7 +82,7 @@
     }
 
     public void addClassComment(InnerClass innerClass, FullyQualifiedTable table) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         innerClass.addJavaDocLine("/**"); //$NON-NLS-1$
         innerClass.addJavaDocLine(" * This class was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -97,7 +97,7 @@
     }
 
     public void addEnumComment(InnerEnum innerEnum, FullyQualifiedTable table) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         innerEnum.addJavaDocLine("/**"); //$NON-NLS-1$
         innerEnum.addJavaDocLine(" * This enum was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -112,7 +112,7 @@
     }
 
     public void addGetterComment(Method method, FullyQualifiedTable table, String columnName) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
         method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -138,7 +138,7 @@
     }
 
     public void addSetterComment(Method method, FullyQualifiedTable table, String columnName) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
         method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -167,7 +167,7 @@
     }
 
     public void addGeneralMethodComment(Method method, FullyQualifiedTable table) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         method.addJavaDocLine("/**"); //$NON-NLS-1$
         method.addJavaDocLine(" * This method was generated by Apache iBATIS ibator."); //$NON-NLS-1$
@@ -197,7 +197,7 @@
 
         String s = getDateString();
         if (s != null) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             sb.append("  This element was generated on "); //$NON-NLS-1$
             sb.append(s);
             sb.append('.');
@@ -230,7 +230,7 @@
      */
     protected void addIbatorJavadocTag(JavaElement javaElement) {
         javaElement.addJavaDocLine(" *"); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(" * "); //$NON-NLS-1$
         sb.append(MergeConstants.NEW_JAVA_ELEMENT_TAG);
         String s = getDateString();

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultDAOMethodNameCalculator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultDAOMethodNameCalculator.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultDAOMethodNameCalculator.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultDAOMethodNameCalculator.java Wed Jul 23 16:29:10 2008
@@ -154,4 +154,8 @@
             return "updateByExampleWithoutBLOBs"; //$NON-NLS-1$
         }
     }
+
+    public String getInsertSelectiveMethodName(IntrospectedTable introspectedTable) {
+        return "insertSelective"; //$NON-NLS-1$
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultShellCallback.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultShellCallback.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultShellCallback.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/DefaultShellCallback.java Wed Jul 23 16:29:10 2008
@@ -56,7 +56,7 @@
                     targetProject));
         }
         
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         StringTokenizer st = new StringTokenizer(targetPackage, "."); //$NON-NLS-1$
         while (st.hasMoreTokens()) {
             sb.append(st.nextToken());

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/ExtendedDAOMethodNameCalculator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/ExtendedDAOMethodNameCalculator.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/ExtendedDAOMethodNameCalculator.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/ExtendedDAOMethodNameCalculator.java Wed Jul 23 16:29:10 2008
@@ -34,7 +34,7 @@
     }
 
     public String getInsertMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("insert"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         
@@ -50,7 +50,7 @@
      * 3. Else the method name should be updateByPrimaryKeyWithoutBLOBs
      */
     public String getUpdateByPrimaryKeyWithoutBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
@@ -77,7 +77,7 @@
      * 3. Else the method name should be updateByPrimaryKeyWithBLOBs
      */
     public String getUpdateByPrimaryKeyWithBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         
@@ -95,7 +95,7 @@
     }
 
     public String getDeleteByExampleMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("delete"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByExample"); //$NON-NLS-1$
@@ -104,7 +104,7 @@
     }
 
     public String getDeleteByPrimaryKeyMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("delete"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByPrimaryKey"); //$NON-NLS-1$
@@ -118,7 +118,7 @@
      * 2. Else the method name should be selectByExampleWithoutBLOBs
      */
     public String getSelectByExampleWithoutBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByExample"); //$NON-NLS-1$
@@ -138,7 +138,7 @@
      * 2. Else the method name should be selectByExampleWithBLOBs
      */
     public String getSelectByExampleWithBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByExample"); //$NON-NLS-1$
@@ -153,7 +153,7 @@
     }
 
     public String getSelectByPrimaryKeyMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByPrimaryKey"); //$NON-NLS-1$
@@ -163,7 +163,7 @@
 
 
     public String getUpdateByPrimaryKeySelectiveMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByPrimaryKeySelective"); //$NON-NLS-1$
@@ -172,7 +172,7 @@
     }
 
     public String getCountByExampleMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("count"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByExample"); //$NON-NLS-1$
@@ -181,7 +181,7 @@
     }
 
     public String getUpdateByExampleSelectiveMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         sb.append("ByExampleSelective"); //$NON-NLS-1$
@@ -190,7 +190,7 @@
     }
 
     public String getUpdateByExampleWithBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
         
@@ -208,7 +208,7 @@
     }
 
     public String getUpdateByExampleWithoutBLOBsMethodName(IntrospectedTable introspectedTable) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("update"); //$NON-NLS-1$
         sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
@@ -225,4 +225,13 @@
         
         return sb.toString();
     }
+
+    public String getInsertSelectiveMethodName(IntrospectedTable introspectedTable) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("insert"); //$NON-NLS-1$
+        sb.append(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
+        sb.append("Selective"); //$NON-NLS-1$
+        
+        return sb.toString();
+    }
 }

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=679231&r1=679230&r2=679231&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 Jul 23 16:29:10 2008
@@ -899,4 +899,46 @@
 
         return rc;
     }
+
+    public boolean sqlMapInsertSelectiveElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
+        boolean rc = true;
+
+        for (IbatorPlugin plugin : plugins) {
+            if (!plugin
+                    .sqlMapInsertSelectiveElementGenerated(element, introspectedTable)) {
+                rc = false;
+                break;
+            }
+        }
+
+        return rc;
+    }
+
+    public boolean daoInsertSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
+        boolean rc = true;
+
+        for (IbatorPlugin plugin : plugins) {
+            if (!plugin.daoInsertSelectiveMethodGenerated(method, interfaze,
+                    introspectedTable)) {
+                rc = false;
+                break;
+            }
+        }
+
+        return rc;
+    }
+
+    public boolean daoInsertSelectiveMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
+        boolean rc = true;
+
+        for (IbatorPlugin plugin : plugins) {
+            if (!plugin.daoInsertSelectiveMethodGenerated(method, topLevelClass,
+                    introspectedTable)) {
+                rc = false;
+                break;
+            }
+        }
+
+        return rc;
+    }
 }

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/ColumnDefinition.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/ColumnDefinition.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/ColumnDefinition.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/ColumnDefinition.java Wed Jul 23 16:29:10 2008
@@ -115,7 +115,7 @@
 	 */
     @Override
     public String toString() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("Actual Column Name: "); //$NON-NLS-1$
         sb.append(actualColumnName);
@@ -184,7 +184,7 @@
             return javaProperty;
         }
         
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(prefix);
         sb.append(javaProperty);
         
@@ -212,7 +212,7 @@
      */
     public String getRenamedColumnNameForResultMap() {
         if (StringUtility.stringHasValue(tableAlias)) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             
             sb.append(tableAlias);
             sb.append('_');
@@ -232,7 +232,7 @@
      */
     public String getSelectListPhrase() {
         if (StringUtility.stringHasValue(tableAlias)) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             
             sb.append(getAliasedEscapedColumnName());
             sb.append(" as "); //$NON-NLS-1$
@@ -266,7 +266,7 @@
     }
     
     public String getIbatisFormattedParameterClause(String prefix) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         
         sb.append('#');
         sb.append(getJavaProperty(prefix));
@@ -296,7 +296,7 @@
     
     private String escapeStringForIbatis(String s) {
         StringTokenizer st = new StringTokenizer(s, "$#", true); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         while (st.hasMoreTokens()) {
             String token = st.nextToken();
             if ("$".equals(token)) { //$NON-NLS-1$
@@ -316,7 +316,7 @@
     }
 
     public String getEscapedColumnName() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(escapeStringForIbatis(actualColumnName));
         
         if (isColumnNameDelimited) {
@@ -340,7 +340,7 @@
      * @return the aliased column name
      */
     public String getAliasedActualColumnName() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         if (StringUtility.stringHasValue(tableAlias)) {
             sb.append(tableAlias);
             sb.append('.');
@@ -366,7 +366,7 @@
      */
     public String getAliasedEscapedColumnName() {
         if (StringUtility.stringHasValue(tableAlias)) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             
             sb.append(tableAlias);
             sb.append('.');

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/DatabaseIntrospector.java Wed Jul 23 16:29:10 2008
@@ -362,7 +362,7 @@
         if (tc.isWildcardEscapingEnabled()) {
             String escapeString = databaseMetaData.getSearchStringEscape();
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             StringTokenizer st;
             if (localSchema != null) {
                 st = new StringTokenizer(localSchema, "_%", true); //$NON-NLS-1$

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/IntrospectedTableDefaultImpl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/IntrospectedTableDefaultImpl.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/IntrospectedTableDefaultImpl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/db/IntrospectedTableDefaultImpl.java Wed Jul 23 16:29:10 2008
@@ -165,7 +165,7 @@
     }
 
     public FullyQualifiedJavaType getPrimaryKeyType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getJavaModelPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -177,7 +177,7 @@
     }
 
     public FullyQualifiedJavaType getBaseRecordType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getJavaModelPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -188,7 +188,7 @@
     }
 
     public FullyQualifiedJavaType getRecordWithBLOBsType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getJavaModelPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -200,7 +200,7 @@
     }
 
     public FullyQualifiedJavaType getExampleType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getJavaModelPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -223,7 +223,7 @@
      * @return the name of the SqlMap file
      */
     public String getSqlMapFileName() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(fullyQualifiedTable.getSqlMapNamespace());
         sb.append("_SqlMap.xml"); //$NON-NLS-1$
 
@@ -238,7 +238,7 @@
     public String getSqlMapPackage() {
         SqlMapGeneratorConfiguration config = ibatorContext.getSqlMapGeneratorConfiguration();
         
-        StringBuffer sb = new StringBuffer(config.getTargetPackage());
+        StringBuilder sb = new StringBuilder(config.getTargetPackage());
         if (StringUtility.isTrue(config.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) {
             sb.append(fullyQualifiedTable.getSubPackage());
         }
@@ -247,7 +247,7 @@
     }
 
     public FullyQualifiedJavaType getDAOImplementationType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getDAOPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -259,7 +259,7 @@
     }
 
     public FullyQualifiedJavaType getDAOInterfaceType() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(getDAOPackage());
         sb.append('.');
         sb.append(fullyQualifiedTable.getDomainObjectName());
@@ -277,7 +277,7 @@
     protected String getDAOPackage() {
         DAOGeneratorConfiguration config = ibatorContext.getDaoGeneratorConfiguration();
         
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(config.getTargetPackage());
         if (StringUtility.isTrue(config.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) {
             sb.append(fullyQualifiedTable.getSubPackage());
@@ -289,7 +289,7 @@
     protected String getJavaModelPackage() {
         JavaModelGeneratorConfiguration config = ibatorContext.getJavaModelGeneratorConfiguration();
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(config.getTargetPackage());
         if (StringUtility.isTrue(config.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) {
             sb.append(fullyQualifiedTable.getSubPackage());

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/dao/BaseDAOGenerator.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/dao/BaseDAOGenerator.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/dao/BaseDAOGenerator.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/dao/BaseDAOGenerator.java Wed Jul 23 16:29:10 2008
@@ -238,6 +238,15 @@
             }
         }
 
+        if (rules.generateInsertSelective()) {
+            method = getInsertSelectiveMethod(introspectedTable, false, answer);
+            if (method != null) {
+                if (plugins.daoInsertSelectiveMethodGenerated(method, answer, introspectedTable)) {
+                    answer.addMethod(method);
+                }
+            }
+        }
+
         if (rules.generateUpdateByPrimaryKeyWithoutBLOBs()) {
             method = getUpdateByPrimaryKeyWithoutBLOBsMethod(introspectedTable, false, answer);
             if (method != null) {
@@ -395,6 +404,15 @@
             }
         }
 
+        if (rules.generateInsertSelective()) {
+            method = getInsertSelectiveMethod(introspectedTable, true, answer);
+            if (method != null) {
+                if (plugins.daoInsertSelectiveMethodGenerated(method, answer, introspectedTable)) {
+                    answer.addMethod(method);
+                }
+            }
+        }
+
         if (rules.generateUpdateByPrimaryKeyWithoutBLOBs()) {
             method = getUpdateByPrimaryKeyWithoutBLOBsMethod(introspectedTable, true, answer);
             if (method != null) {
@@ -551,7 +569,7 @@
         
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             if (returnType != null) {
                 sb.append("Object newKey = "); //$NON-NLS-1$
@@ -592,6 +610,89 @@
         return method;
     }
 
+    protected Method getInsertSelectiveMethod(IntrospectedTable introspectedTable,
+            boolean interfaceMethod, CompilationUnit compilationUnit) {
+
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        Method method = new Method();
+
+        FullyQualifiedJavaType returnType;
+        if (introspectedTable.getGeneratedKey() != null) {
+            ColumnDefinition cd = introspectedTable.getColumn(
+                            introspectedTable.getGeneratedKey().getColumn());
+            if (cd == null) {
+                // the specified column doesn't exist, so don't do the generated
+                // key
+                // (the warning has already been reported)
+                returnType = null;
+            } else {
+                returnType = cd.getResolvedJavaType()
+                        .getFullyQualifiedJavaType();
+                compilationUnit.addImportedType(returnType);
+            }
+        } else {
+            returnType = null;
+        }
+        method.setReturnType(returnType);
+        method.setVisibility(JavaVisibility.PUBLIC);
+        method.setName(methodNameCalculator.getInsertSelectiveMethodName(introspectedTable));
+
+        FullyQualifiedJavaType parameterType =
+            introspectedTable.getRules().calculateAllFieldsClass();
+        
+        compilationUnit.addImportedType(parameterType);
+        method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
+
+        for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
+            method.addException(fqjt);
+            compilationUnit.addImportedType(fqjt);
+        }
+
+        ibatorContext.getCommentGenerator().addGeneralMethodComment(method, table);
+        
+        if (!interfaceMethod) {
+            // generate the implementation method
+            StringBuilder sb = new StringBuilder();
+
+            if (returnType != null) {
+                sb.append("Object newKey = "); //$NON-NLS-1$
+            }
+
+            sb.append(daoTemplate.getInsertMethod(table.getSqlMapNamespace(), 
+                    XmlConstants.INSERT_SELECTIVE_STATEMENT_ID,
+                    "record")); //$NON-NLS-1$
+            method.addBodyLine(sb.toString());
+
+            if (returnType != null) {
+                if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
+                    // no need to cast if the return type is Object
+                    method.addBodyLine("return newKey;"); //$NON-NLS-1$
+                } else {
+                    sb.setLength(0);
+
+                    if (returnType.isPrimitive()) {
+                        PrimitiveTypeWrapper ptw = returnType
+                                .getPrimitiveTypeWrapper();
+                        sb.append("return (("); //$NON-NLS-1$
+                        sb.append(ptw.getShortName());
+                        sb.append(") newKey"); //$NON-NLS-1$
+                        sb.append(")."); //$NON-NLS-1$
+                        sb.append(ptw.getToPrimitiveMethod());
+                        sb.append(';');
+                    } else {
+                        sb.append("return ("); //$NON-NLS-1$
+                        sb.append(returnType.getShortName());
+                        sb.append(") newKey;"); //$NON-NLS-1$
+                    }
+
+                    method.addBodyLine(sb.toString());
+                }
+            }
+        }
+
+        return method;
+    }
+
     protected Method getUpdateByPrimaryKeyWithoutBLOBsMethod(
             IntrospectedTable introspectedTable, boolean interfaceMethod,
             CompilationUnit compilationUnit) {
@@ -616,7 +717,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
@@ -660,7 +761,7 @@
         
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
@@ -704,7 +805,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
@@ -770,7 +871,7 @@
                 method.addSuppressTypeWarningsAnnotation();
             }
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             sb.append(returnType.getShortName());
             sb.append(" list = "); //$NON-NLS-1$
             sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(),
@@ -832,7 +933,7 @@
                 method.addSuppressTypeWarningsAnnotation();
             }
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             sb.append(returnType.getShortName());
             sb.append(" list = "); //$NON-NLS-1$
             sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(),
@@ -882,7 +983,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             if (!introspectedTable.getRules().generatePrimaryKeyClass()) {
                 // no primary key class, but primary key is enabled.  Primary
@@ -950,7 +1051,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getDeleteMethod(table.getSqlMapNamespace(),
@@ -995,7 +1096,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             if (!introspectedTable.getRules().generatePrimaryKeyClass()) {
                 // no primary key class, but primary key is enabled.  Primary
@@ -1060,7 +1161,7 @@
 
         if (!interfaceMethod) {
             // generate the implementation method
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("Integer count = (Integer)  "); //$NON-NLS-1$
             sb.append(daoTemplate.getQueryForObjectMethod(table.getSqlMapNamespace(),
@@ -1121,7 +1222,7 @@
             // generate the implementation method
             method.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             
             sb.append("int rows = "); //$NON-NLS-1$
             
@@ -1214,7 +1315,7 @@
             // generate the implementation method
             method.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),
@@ -1264,7 +1365,7 @@
             // generate the implementation method
             method.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
             
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
 
             sb.append("int rows = "); //$NON-NLS-1$
             sb.append(daoTemplate.getUpdateMethod(table.getSqlMapNamespace(),

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava2Impl.java Wed Jul 23 16:29:10 2008
@@ -124,7 +124,7 @@
         boolean trimStrings = StringUtility.isTrue(properties
                 .getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS));
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         Field field;
         Method method;
 
@@ -397,7 +397,7 @@
         method.setVisibility(JavaVisibility.PUBLIC);
         method.addParameter(new Parameter(cd.getResolvedJavaType()
                 .getFullyQualifiedJavaType(), "value")); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(cd.getJavaProperty());
         sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
         sb.insert(0, "and"); //$NON-NLS-1$
@@ -450,7 +450,7 @@
                 method.addSuppressTypeWarningsAnnotation();
             }
         }
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(cd.getJavaProperty());
         sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
         sb.insert(0, "and"); //$NON-NLS-1$
@@ -483,7 +483,7 @@
         
         method.addParameter(new Parameter(type, "value1")); //$NON-NLS-1$
         method.addParameter(new Parameter(type, "value2")); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(cd.getJavaProperty());
         sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
         sb.insert(0, "and"); //$NON-NLS-1$
@@ -717,7 +717,7 @@
         method.setVisibility(JavaVisibility.PUBLIC);
         method.setName("isValid"); //$NON-NLS-1$
         method.setReturnType(FullyQualifiedJavaType.getBooleanPrimitiveInstance());
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         Iterator<String> strIter = criteriaLists.iterator();
         sb.append("return "); //$NON-NLS-1$
         sb.append(strIter.next());
@@ -1070,7 +1070,7 @@
         FullyQualifiedJavaType type = FullyQualifiedJavaType
                 .getNewListInstance();
         method.addParameter(new Parameter(type, "values")); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(cd.getJavaProperty());
         sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
         sb.insert(0, "and"); //$NON-NLS-1$
@@ -1123,7 +1123,7 @@
     private List<String> addtypeHandledObjectsAndMethods(ColumnDefinition cd,
             Method constructor, InnerClass innerClass) {
         List<String> answer = new ArrayList<String>();
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         // add new private fields and public accessors in the class
         FullyQualifiedJavaType listOfMaps = FullyQualifiedJavaType

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/java/model/JavaModelGeneratorJava5Impl.java Wed Jul 23 16:29:10 2008
@@ -224,7 +224,7 @@
         method.setName("isValid"); //$NON-NLS-1$
         method.setReturnType(FullyQualifiedJavaType.getBooleanPrimitiveInstance());
         Iterator<String> strIter = criteriaLists.iterator();
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("return "); //$NON-NLS-1$
         sb.append(strIter.next());
         sb.append(".size() > 0"); //$NON-NLS-1$
@@ -579,7 +579,7 @@
                     .getFullyQualifiedJavaType());
         }
         method.addParameter(new Parameter(type, "values")); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(cd.getJavaProperty());
         sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
         sb.insert(0, "and"); //$NON-NLS-1$
@@ -632,7 +632,7 @@
     private List<String> addtypeHandledObjectsAndMethods(ColumnDefinition cd,
             Method constructor, InnerClass innerClass) {
         List<String> answer = new ArrayList<String>();
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         // add new private fields and public accessors in the class
         FullyQualifiedJavaType innerMapType = FullyQualifiedJavaType

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/rules/IbatorRules.java Wed Jul 23 16:29:10 2008
@@ -55,6 +55,17 @@
     }
 
     /**
+     * Implements the rule for generating the insert selective SQL Map element and DAO
+     * method. If the insert statement is allowed, then generate the element and
+     * method.
+     * 
+     * @return true if the element and method should be generated
+     */
+    public boolean generateInsertSelective() {
+        return tableConfiguration.isInsertStatementEnabled();
+    }
+    
+    /**
      * Calculates the class that contains all fields.  This class is used
      * as the insert statement parameter, as well as the returned value
      * from the select by primary key method.  The actual class depends

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/SqlMapGeneratorIterateImpl.java Wed Jul 23 16:29:10 2008
@@ -213,6 +213,15 @@
             }
         }
 
+        if (rules.generateInsertSelective()) {
+            element = getInsertSelectiveElement(introspectedTable);
+            if (element != null) {
+                if (plugins.sqlMapInsertSelectiveElementGenerated(element, introspectedTable)) {
+                    answer.addElement(element);
+                }
+            }
+        }
+
         if (rules.generateUpdateByPrimaryKeyWithBLOBs()) {
             element = getUpdateByPrimaryKeyWithBLOBs(introspectedTable);
             if (element != null) {
@@ -368,7 +377,7 @@
         answer.addAttribute(new Attribute("class", //$NON-NLS-1$
                 returnType.getFullyQualifiedName()));
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append(table.getSqlMapNamespace());
         sb.append('.');
         sb.append(XmlConstants.BASE_RESULT_MAP_ID);
@@ -441,8 +450,8 @@
             }
         }
 
-        StringBuffer insertClause = new StringBuffer();
-        StringBuffer valuesClause = new StringBuffer();
+        StringBuilder insertClause = new StringBuilder();
+        StringBuilder valuesClause = new StringBuilder();
 
         insertClause.append("insert into "); //$NON-NLS-1$
         insertClause.append(table.getFullyQualifiedTableNameAtRuntime());
@@ -487,6 +496,91 @@
     }
 
     /**
+     * This method should return an XmlElement which is the insert 
+     * selective statement.
+     * 
+     * @param introspectedTable
+     * @return the insert element
+     */
+    protected XmlElement getInsertSelectiveElement(IntrospectedTable introspectedTable) {
+        
+        XmlElement answer = new XmlElement("insert"); //$NON-NLS-1$
+
+        FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable();
+        answer.addAttribute(new Attribute("id", XmlConstants.INSERT_SELECTIVE_STATEMENT_ID)); //$NON-NLS-1$
+        
+        FullyQualifiedJavaType parameterType =
+            introspectedTable.getRules().calculateAllFieldsClass();
+        
+        answer.addAttribute(new Attribute("parameterClass", //$NON-NLS-1$
+                parameterType.getFullyQualifiedName()));
+
+        ibatorContext.getCommentGenerator().addComment(answer);
+
+        GeneratedKey gk = introspectedTable.getGeneratedKey();
+
+        if (gk != null && gk.isBeforeInsert()) {
+            ColumnDefinition cd = introspectedTable.getColumn(gk.getColumn());
+            // if the column is null, then it's a configuration error. The
+            // warning has already been reported
+            if (cd != null) {
+                // pre-generated key
+                answer.addElement(getSelectKey(cd, gk));
+            }
+        }
+        
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("insert into "); //$NON-NLS-1$
+        sb.append(table.getFullyQualifiedTableNameAtRuntime());
+        answer.addElement(new TextElement(sb.toString()));
+        
+        XmlElement insertElement = new XmlElement("dynamic");
+        insertElement.addAttribute(new Attribute("prepend", "("));
+        answer.addElement(insertElement);
+        
+        answer.addElement(new TextElement("values"));
+
+        XmlElement valuesElement = new XmlElement("dynamic");
+        valuesElement.addAttribute(new Attribute("prepend", "("));
+        answer.addElement(valuesElement);
+        
+        for (ColumnDefinition cd : introspectedTable.getAllColumns()) {
+            if (cd.isIdentity()) {
+                // cannot set values on identity fields
+                continue;
+            }
+            
+            XmlElement insertNotNullElement = new XmlElement("isNotNull");
+            insertNotNullElement.addAttribute(new Attribute("prepend", ","));
+            insertNotNullElement.addAttribute(new Attribute("property", cd.getJavaProperty()));
+            insertNotNullElement.addElement(new TextElement(cd.getEscapedColumnName()));
+            insertElement.addElement(insertNotNullElement);
+            
+            XmlElement valuesNotNullElement = new XmlElement("isNotNull");
+            valuesNotNullElement.addAttribute(new Attribute("prepend", ","));
+            valuesNotNullElement.addAttribute(new Attribute("property", cd.getJavaProperty()));
+            valuesNotNullElement.addElement(new TextElement(cd.getIbatisFormattedParameterClause()));
+            valuesElement.addElement(valuesNotNullElement);
+        }
+        
+        insertElement.addElement(new TextElement(")"));
+        valuesElement.addElement(new TextElement(")"));
+        
+        if (gk != null && !gk.isBeforeInsert()) {
+            ColumnDefinition cd = introspectedTable.getColumn(gk.getColumn());
+            // if the column is null, then it's a configuration error. The
+            // warning has already been reported
+            if (cd != null) {
+                // pre-generated key
+                answer.addElement(getSelectKey(cd, gk));
+            }
+        }
+
+        return answer;
+    }
+
+    /**
      * This method should return an XmlElement for the update by primary key
      * statement that updates all fields in the table (including BLOB fields).
      * 
@@ -514,7 +608,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getFullyQualifiedTableNameAtRuntime());
@@ -583,7 +677,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));
@@ -657,7 +751,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("delete from "); //$NON-NLS-1$
         sb.append(table.getFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));
@@ -703,7 +797,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("delete from "); //$NON-NLS-1$
         sb.append(table.getAliasedFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));
@@ -745,7 +839,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select count(*) from "); //$NON-NLS-1$
         sb.append(table.getAliasedFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));
@@ -800,7 +894,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
         boolean comma = false;
@@ -880,7 +974,7 @@
      * @return the name of the example where clause element
      */
     protected String getExampleWhereClauseId() {
-        StringBuffer sb = new StringBuffer(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        StringBuilder sb = new StringBuilder(MergeConstants.NEW_XML_ELEMENT_PREFIX);
         sb.append("Example_Where_Clause"); //$NON-NLS-1$
 
         return sb.toString();
@@ -974,8 +1068,8 @@
             if (StringUtility.stringHasValue(cd.getTypeHandler())) {
                 // name the property based on the column name, then
                 // add the type handler to the parameter declaration
-                StringBuffer sb1 = new StringBuffer();
-                StringBuffer sb2 = new StringBuffer();
+                StringBuilder sb1 = new StringBuilder();
+                StringBuilder sb2 = new StringBuilder();
                 innerIterateElement = new XmlElement("iterate"); //$NON-NLS-1$
                 innerIterateElement.addAttribute(new Attribute("prepend", "and")); //$NON-NLS-1$ //$NON-NLS-2$
                 
@@ -1108,7 +1202,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
         boolean comma = false;
@@ -1176,7 +1270,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("select "); //$NON-NLS-1$
 
         boolean comma = false;
@@ -1261,7 +1355,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getFullyQualifiedTableNameAtRuntime());
@@ -1326,7 +1420,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getAliasedFullyQualifiedTableNameAtRuntime());
@@ -1371,7 +1465,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getAliasedFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));
@@ -1422,7 +1516,7 @@
 
         ibatorContext.getCommentGenerator().addComment(answer);
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("update "); //$NON-NLS-1$
         sb.append(table.getAliasedFullyQualifiedTableNameAtRuntime());
         answer.addElement(new TextElement(sb.toString()));

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/sqlmap/XmlConstants.java Wed Jul 23 16:29:10 2008
@@ -30,7 +30,7 @@
     }
     
     static {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
         sb.append("countByExample"); //$NON-NLS-1$
@@ -53,6 +53,11 @@
         
         sb.setLength(0);
         sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
+        sb.append("insertSelective"); //$NON-NLS-1$
+        INSERT_SELECTIVE_STATEMENT_ID = sb.toString();
+        
+        sb.setLength(0);
+        sb.append(MergeConstants.NEW_XML_ELEMENT_PREFIX);
         sb.append("selectByExample"); //$NON-NLS-1$
         SELECT_BY_EXAMPLE_STATEMENT_ID = sb.toString();
 
@@ -127,6 +132,8 @@
     
     public static final String INSERT_STATEMENT_ID;
     
+    public static final String INSERT_SELECTIVE_STATEMENT_ID;
+    
     public static final String SELECT_BY_EXAMPLE_STATEMENT_ID;
     
     public static final String SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID;

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/JavaBeansUtil.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/JavaBeansUtil.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/JavaBeansUtil.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/JavaBeansUtil.java Wed Jul 23 16:29:10 2008
@@ -48,7 +48,7 @@
      * @return the getter method name
      */
 	public static String getGetterMethodName(String property, FullyQualifiedJavaType fullyQualifiedJavaType) {
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 
 		sb.append(property);
 		if (Character.isLowerCase(sb.charAt(0))) {
@@ -83,7 +83,7 @@
      * @return the setter method name
      */
 	public static String getSetterMethodName(String property) {
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 
 		sb.append(property);
 		if (Character.isLowerCase(sb.charAt(0))) {
@@ -99,7 +99,7 @@
 
 	public static String getCamelCaseString(String inputString,
 			boolean firstCharacterUppercase) {
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 
 		boolean nextUpperCase = false;
 		for (int i = 0; i < inputString.length(); i++) {

Modified: ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java?rev=679231&r1=679230&r2=679231&view=diff
==============================================================================
--- ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java (original)
+++ ibatis/trunk/java/tools/ibator/core/src/org/apache/ibatis/ibator/internal/util/StringUtility.java Wed Jul 23 16:29:10 2008
@@ -36,7 +36,7 @@
 
     public static String composeFullyQualifiedTableName(String catalog, String schema,
             String tableName, char separator) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         if (stringHasValue(catalog)) {
             sb.append(catalog);
@@ -63,7 +63,7 @@
 
     public static String escapeStringForJava(String s) {
         StringTokenizer st = new StringTokenizer(s, "\"", true); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         while (st.hasMoreTokens()) {
             String token = st.nextToken();
             if ("\"".equals(token)) { //$NON-NLS-1$
@@ -78,7 +78,7 @@
 
     public static String escapeStringForXml(String s) {
         StringTokenizer st = new StringTokenizer(s, "\"", true); //$NON-NLS-1$
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         while (st.hasMoreTokens()) {
             String token = st.nextToken();
             if ("\"".equals(token)) { //$NON-NLS-1$



Mime
View raw message