Author: jgbutler Date: Thu Jun 26 19:09:53 2008 New Revision: 672075 URL: http://svn.apache.org/viewvc?rev=672075&view=rev Log: ibator: fix for IBATIS-518
Modified: ibatis/trunk/java/tools/ibator/core/build/version.properties 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/internal/java/dao/BaseDAOGenerator.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=672075&r1=672074&r2=672075&view=diff ============================================================================== --- ibatis/trunk/java/tools/ibator/core/build/version.properties (original) +++ ibatis/trunk/java/tools/ibator/core/build/version.properties Thu Jun 26 19:09:53 2008 @@ -1,4 +1,4 @@ #ibator build version info -#Thu Jun 05 13:28:34 CDT 2008 +#Thu Jun 26 21:06:44 CDT 2008 version=1.2.0 -buildNum=556 +buildNum=559 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=672075&r1=672074&r2=672075&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 Thu Jun 26 19:09:53 2008 @@ -247,7 +247,7 @@ .getTargetProject(), gjf.getTargetPackage(), warnings); targetFile = new File(directory, gjf.getFileName()); if (targetFile.exists()) { - if (shellCallback.mergeSupported()) { + if (shellCallback.mergeSupported() && gjf.isMergeable()) { source = shellCallback.mergeJavaFile(gjf, MergeConstants.OLD_JAVA_ELEMENT_TAGS, warnings); 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=672075&r1=672074&r2=672075&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 Thu Jun 26 19:09:53 2008 @@ -735,7 +735,7 @@ Method method = new Method(); method.setVisibility(exampleMethodVisibility); - FullyQualifiedJavaType returnType; + FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance();; if (useJava5Features) { FullyQualifiedJavaType fqjt; if (introspectedTable.getRules().generateBaseRecordClass()) { @@ -748,11 +748,9 @@ } compilationUnit.addImportedType(fqjt); - returnType = FullyQualifiedJavaType.getNewListInstance(); returnType.addTypeArgument(fqjt); - } else { - returnType = FullyQualifiedJavaType.getNewListInstance(); } + method.setReturnType(returnType); method.setName(methodNameCalculator.getSelectByExampleWithoutBLOBsMethodName(introspectedTable)); @@ -767,18 +765,14 @@ if (!interfaceMethod) { // generate the implementation method - StringBuffer sb = new StringBuffer(); if (useJava5Features) { method.addSuppressTypeWarningsAnnotation(); - sb.append(returnType.getShortName()); - sb.append(" list = ("); //$NON-NLS-1$ - sb.append(returnType.getShortName()); - sb.append(") "); //$NON-NLS-1$ - } else { - sb.append("List list = "); //$NON-NLS-1$ } - + + StringBuffer sb = new StringBuffer(); + sb.append(returnType.getShortName()); + sb.append(" list = "); //$NON-NLS-1$ sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(), XmlConstants.SELECT_BY_EXAMPLE_STATEMENT_ID, "example")); //$NON-NLS-1$ @@ -806,21 +800,18 @@ Method method = new Method(); method.setVisibility(exampleMethodVisibility); - FullyQualifiedJavaType returnType; + FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance(); if (useJava5Features) { FullyQualifiedJavaType fqjt; if (introspectedTable.getRules().generateRecordWithBLOBsClass()) { fqjt = introspectedTable.getRecordWithBLOBsType(); } else { - // the blob fileds must be rolled up into the base class + // the blob fields must be rolled up into the base class fqjt = introspectedTable.getBaseRecordType(); } compilationUnit.addImportedType(fqjt); - returnType = FullyQualifiedJavaType.getNewListInstance(); returnType.addTypeArgument(fqjt); - } else { - returnType = FullyQualifiedJavaType.getNewListInstance(); } method.setReturnType(returnType); @@ -837,18 +828,13 @@ if (!interfaceMethod) { // generate the implementation method - StringBuffer sb = new StringBuffer(); - if (useJava5Features) { method.addSuppressTypeWarningsAnnotation(); - sb.append(returnType.getShortName()); - sb.append(" list = ("); //$NON-NLS-1$ - sb.append(returnType.getShortName()); - sb.append(") "); //$NON-NLS-1$ - } else { - sb.append("List list = "); //$NON-NLS-1$ } - + + StringBuffer sb = new StringBuffer(); + sb.append(returnType.getShortName()); + sb.append(" list = "); //$NON-NLS-1$ sb.append(daoTemplate.getQueryForListMethod(table.getSqlMapNamespace(), XmlConstants.SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID, "example")); //$NON-NLS-1$ @@ -1100,6 +1086,10 @@ IntrospectedTable introspectedTable, boolean interfaceMethod, CompilationUnit compilationUnit) { + if (interfaceMethod && exampleMethodVisibility != JavaVisibility.PUBLIC) { + return null; + } + FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); FullyQualifiedJavaType parameterType; @@ -1114,7 +1104,7 @@ compilationUnit.addImportedType(parameterType); Method method = new Method(); - method.setVisibility(JavaVisibility.PUBLIC); + method.setVisibility(exampleMethodVisibility); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName(methodNameCalculator.getUpdateByExampleSelectiveMethodName(introspectedTable)); method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$ @@ -1191,6 +1181,11 @@ protected Method getUpdateByExampleWithBLOBsMethod( IntrospectedTable introspectedTable, boolean interfaceMethod, CompilationUnit compilationUnit) { + + if (interfaceMethod && exampleMethodVisibility != JavaVisibility.PUBLIC) { + return null; + } + FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); FullyQualifiedJavaType parameterType; if (introspectedTable.getRules().generateRecordWithBLOBsClass()) { @@ -1202,7 +1197,7 @@ compilationUnit.addImportedType(parameterType); Method method = new Method(); - method.setVisibility(JavaVisibility.PUBLIC); + method.setVisibility(exampleMethodVisibility); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName(methodNameCalculator.getUpdateByExampleWithBLOBsMethodName(introspectedTable)); method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$ @@ -1237,6 +1232,10 @@ IntrospectedTable introspectedTable, boolean interfaceMethod, CompilationUnit compilationUnit) { + if (interfaceMethod && exampleMethodVisibility != JavaVisibility.PUBLIC) { + return null; + } + FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); FullyQualifiedJavaType parameterType; if (introspectedTable.getRules().generateBaseRecordClass()) { @@ -1248,7 +1247,7 @@ compilationUnit.addImportedType(parameterType); Method method = new Method(); - method.setVisibility(JavaVisibility.PUBLIC); + method.setVisibility(exampleMethodVisibility); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName(methodNameCalculator.getUpdateByExampleWithoutBLOBsMethodName(introspectedTable)); method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$