org.apache.ibatis.abator.internal.java.dao
Class BaseJava2DAOGenerator

java.lang.Object
  extended byorg.apache.ibatis.abator.internal.java.BaseJavaCodeGenerator
      extended byorg.apache.ibatis.abator.internal.java.dao.BaseJava2DAOGenerator
All Implemented Interfaces:
DAOGenerator
Direct Known Subclasses:
GenericCIJava2DAOGenerator, GenericSIJava2DAOGenerator, IbatisJava2DAOGenerator, SpringJava2DAOGenerator

public class BaseJava2DAOGenerator
extends BaseJavaCodeGenerator
implements DAOGenerator

This class generates DAO classes based on the values in the supplied DAOTemplate. This class supports the following properties:

enableSubPackages
If true, the classes will be generated in sub-packaged based on the database catalg and schema - else the will be generated in the specified package (the targetPackage attribute). Default is false.
rootInterface
If specified, then the root interface of the DAO interface class will be set to the specified value. No checking is done to see if the specified interface exists, or if the generated interface overrides any root interface methods.

Author:
Jeff Butler

Field Summary
protected  JavaModelGenerator javaModelGenerator
           
protected  java.util.Map properties
           
protected  SqlMapGenerator sqlMapGenerator
           
protected  java.lang.String targetPackage
           
protected  java.lang.String targetProject
           
protected  java.util.List warnings
           
 
Fields inherited from class org.apache.ibatis.abator.internal.java.BaseJavaCodeGenerator
lineSeparator
 
Constructor Summary
BaseJava2DAOGenerator(AbstractDAOTemplate daoTemplate)
           
 
Method Summary
protected  GeneratedJavaFile getDAOImplementation(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration)
           
protected  FullyQualifiedJavaType getDAOImplementationType(FullyQualifiedTable table)
           
protected  GeneratedJavaFile getDAOInterface(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration)
           
protected  FullyQualifiedJavaType getDAOInterfaceType(FullyQualifiedTable table)
           
protected  java.lang.String getDAOPackage(FullyQualifiedTable table)
           
protected  java.util.List getDeleteByExampleMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getDeleteByPrimaryKeyMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
 java.util.List getGeneratedJavaFiles(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, ProgressCallback callback)
          This method returns a list of GenerateJavaFile objects.
protected  java.util.List getInsertMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getSelectByExampleMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getSelectByExampleWithBLOBsMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getSelectByPrimaryKeyMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getUpdateByPrimaryKeyMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
protected  java.util.List getUpdateByPrimaryKeyWithBLOBsMethods(ColumnDefinitions columnDefinitions, TableConfiguration tableConfiguration, boolean interfaceMethod, java.util.Set imports)
           
 void setJavaModelGenerator(JavaModelGenerator javaModelGenerator)
          Sets the instance of JavaModelGenerator associated with this instance.
 void setProperties(java.util.Map properties)
          Sets unique properties for this instance.
 void setSqlMapGenerator(SqlMapGenerator sqlMapGenerator)
          Sets the instance of SqlMapGenerator associated with this instance.
 void setTargetPackage(java.lang.String targetPackage)
          Sets the target package for this instance.
 void setTargetProject(java.lang.String targetProject)
           
 void setWarnings(java.util.List warnings)
          Abator will supply a list to this method.
 
Methods inherited from class org.apache.ibatis.abator.internal.java.BaseJavaCodeGenerator
getFieldComment, getFieldComment, getGetterMethodComment, getMethodComment, getMethodComment, getSetterMethodComment, indent, newLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

protected java.util.Map properties

warnings

protected java.util.List warnings

targetPackage

protected java.lang.String targetPackage

targetProject

protected java.lang.String targetProject

javaModelGenerator

protected JavaModelGenerator javaModelGenerator

sqlMapGenerator

protected SqlMapGenerator sqlMapGenerator
Constructor Detail

BaseJava2DAOGenerator

public BaseJava2DAOGenerator(AbstractDAOTemplate daoTemplate)
Method Detail

setProperties

public void setProperties(java.util.Map properties)
Description copied from interface: DAOGenerator
Sets unique properties for this instance. The properties consist of the default properties for the DAOGenerator, overridden and added to by any DAOGenerator properties that are unique to the current table. This method will be called before any of the get methods.

Specified by:
setProperties in interface DAOGenerator
Parameters:
properties - All properties from the configuration

setWarnings

public void setWarnings(java.util.List warnings)
Description copied from interface: DAOGenerator
Abator will supply a list to this method. The implementation class may add strings to the list that will be treated as warning messages and displayed to the user. The concept of a warning is that code generation can continue, but that the results may not be what is expected.

Specified by:
setWarnings in interface DAOGenerator
Parameters:
warnings -

setTargetPackage

public void setTargetPackage(java.lang.String targetPackage)
Description copied from interface: DAOGenerator
Sets the target package for this instance. This value should be used to calculate the package for the DAO interface and implementation classes. This method will be called before any of the get methods.

Specified by:
setTargetPackage in interface DAOGenerator
Parameters:
targetPackage - The target package from the configuration

setTargetProject

public void setTargetProject(java.lang.String targetProject)
Specified by:
setTargetProject in interface DAOGenerator
Parameters:
targetProject -

setJavaModelGenerator

public void setJavaModelGenerator(JavaModelGenerator javaModelGenerator)
Description copied from interface: DAOGenerator
Sets the instance of JavaModelGenerator associated with this instance. This method will be called before any of the get methods.

Specified by:
setJavaModelGenerator in interface DAOGenerator
Parameters:
javaModelGenerator - The JavaModelGenerator associated with this instance

setSqlMapGenerator

public void setSqlMapGenerator(SqlMapGenerator sqlMapGenerator)
Description copied from interface: DAOGenerator
Sets the instance of SqlMapGenerator associated with this instance. This method will be called before any of the get methods.

Specified by:
setSqlMapGenerator in interface DAOGenerator
Parameters:
sqlMapGenerator - The SqlMapGenerator associated with this instance

getGeneratedJavaFiles

public java.util.List getGeneratedJavaFiles(ColumnDefinitions columnDefinitions,
                                            TableConfiguration tableConfiguration,
                                            ProgressCallback callback)
Description copied from interface: DAOGenerator
This method returns a list of GenerateJavaFile objects. The list may include any, or all, of the following types of generated java classes:

Specified by:
getGeneratedJavaFiles in interface DAOGenerator
Parameters:
columnDefinitions -
tableConfiguration -
callback -
Returns:
a list of GeneratedJavaFile objects

getDAOImplementation

protected GeneratedJavaFile getDAOImplementation(ColumnDefinitions columnDefinitions,
                                                 TableConfiguration tableConfiguration)

getDAOInterface

protected GeneratedJavaFile getDAOInterface(ColumnDefinitions columnDefinitions,
                                            TableConfiguration tableConfiguration)

getDAOImplementationType

protected FullyQualifiedJavaType getDAOImplementationType(FullyQualifiedTable table)

getInsertMethods

protected java.util.List getInsertMethods(ColumnDefinitions columnDefinitions,
                                          TableConfiguration tableConfiguration,
                                          boolean interfaceMethod,
                                          java.util.Set imports)

getUpdateByPrimaryKeyMethods

protected java.util.List getUpdateByPrimaryKeyMethods(ColumnDefinitions columnDefinitions,
                                                      TableConfiguration tableConfiguration,
                                                      boolean interfaceMethod,
                                                      java.util.Set imports)
Parameters:
columnDefinitions - column definitions for the current table
tableConfiguration - table configuration for the current table
interfaceMethod - true if the method is an interface method, false if the method is an implementation method
imports - the method can add FullyQualifiedJavaType objects to this set if they are required by the resulting method
Returns:
a List of methods (as Strings). A method includes Javadoc.

getUpdateByPrimaryKeyWithBLOBsMethods

protected java.util.List getUpdateByPrimaryKeyWithBLOBsMethods(ColumnDefinitions columnDefinitions,
                                                               TableConfiguration tableConfiguration,
                                                               boolean interfaceMethod,
                                                               java.util.Set imports)

getSelectByExampleMethods

protected java.util.List getSelectByExampleMethods(ColumnDefinitions columnDefinitions,
                                                   TableConfiguration tableConfiguration,
                                                   boolean interfaceMethod,
                                                   java.util.Set imports)

getSelectByExampleWithBLOBsMethods

protected java.util.List getSelectByExampleWithBLOBsMethods(ColumnDefinitions columnDefinitions,
                                                            TableConfiguration tableConfiguration,
                                                            boolean interfaceMethod,
                                                            java.util.Set imports)

getSelectByPrimaryKeyMethods

protected java.util.List getSelectByPrimaryKeyMethods(ColumnDefinitions columnDefinitions,
                                                      TableConfiguration tableConfiguration,
                                                      boolean interfaceMethod,
                                                      java.util.Set imports)

getDeleteByExampleMethods

protected java.util.List getDeleteByExampleMethods(ColumnDefinitions columnDefinitions,
                                                   TableConfiguration tableConfiguration,
                                                   boolean interfaceMethod,
                                                   java.util.Set imports)

getDeleteByPrimaryKeyMethods

protected java.util.List getDeleteByPrimaryKeyMethods(ColumnDefinitions columnDefinitions,
                                                      TableConfiguration tableConfiguration,
                                                      boolean interfaceMethod,
                                                      java.util.Set imports)

getDAOPackage

protected java.lang.String getDAOPackage(FullyQualifiedTable table)

getDAOInterfaceType

protected FullyQualifiedJavaType getDAOInterfaceType(FullyQualifiedTable table)