All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.velocity.casban.pertable.manager.interface.vm Maven / Gradle / Ivy

There is a newer version: 5.2.0
Show newest version
#parse( "table.include.vm" )
#parse( "header.include.vm" )
#parse( "macros.include.vm" )
######################
#set ( $javaClassName = $table.asManagerInterfaceNSP() )
#set ( $beanClass = $table.asBeanClassNSP() )
$codewriter.setCurrentJavaFilename(${pkg}, "${javaClassName}.java")
package ${pkg};
import gu.sql2java.TableManager;
#if($table.type != 'VIEW')
import gu.sql2java.exception.ObjectRetrievalException;
import gu.sql2java.exception.RuntimeDaoException;
#end

/**
 * Interface to handle database calls (save, load, count, etc...) for the $tablename table.
#if ( $table.hasRemarks() ) * Remarks: $table.getRemarks() #end * @author guyadong */ public interface ${javaClassName} extends TableManager { #if ( $table.countPrimaryKeys() > 0 ) ////////////////////////////////////// // PRIMARY KEY METHODS ////////////////////////////////////// //1 /** * Loads a {@link $beanClass} from the $tablename using primary key fields. * #foreach ( $pk in $primaryKeys ) * @param $pk.getVarName() ${pk.javaType} - PK# $velocityCount #end * @return a unique $beanClass or {@code null} if not found * @throws RuntimeDaoException */ public B loadByPrimaryKey(#join($primaryKeys "${e.javaType} ${e.varName}" ','))throws RuntimeDaoException; //1.1 /** * Loads a {@link $beanClass} from the $tablename using primary key fields. * #foreach ( $pk in $primaryKeys ) * @param $pk.getVarName() ${pk.javaType} - PK# $velocityCount #end * @return a unique $beanClass * @throws ObjectRetrievalException if not found * @throws RuntimeDaoException */ public B loadByPrimaryKeyChecked(#join($primaryKeys "${e.javaType} ${e.varName}" ',')) throws RuntimeDaoException,ObjectRetrievalException; //1.4 /** * check if contains row with primary key fields. #foreach ( $pk in $primaryKeys ) * @param $pk.getVarName() ${pk.javaType} - PK# $velocityCount #end * @return true if this $tablename contains row with primary key fields. * @throws RuntimeDaoException */ public boolean existsPrimaryKey(#join($primaryKeys "${e.javaType} ${e.varName}" ','))throws RuntimeDaoException; #if ( 1 == $table.countPrimaryKeys() ) #set ($pk = $table.getPrimaryKey()) //1.4.1 /** * Check duplicated row by primary keys,if row exists throw exception * @param $pk.getVarName() primary keys * @return $pk.getVarName() * @throws RuntimeDaoException * @throws ObjectRetrievalException */ public ${pk.javaType} checkDuplicate(${pk.javaType} $pk.getVarName())throws RuntimeDaoException,ObjectRetrievalException; //1.8 /** * Loads {@link $beanClass} from the $tablename using primary key fields. * * @param keys primary keys array * @return list of $beanClass * @throws RuntimeDaoException */ public java.util.List loadByPrimaryKey(${pk.javaType}... keys)throws RuntimeDaoException; //1.9 /** * Loads {@link $beanClass} from the $tablename using primary key fields. * * @param keys primary keys collection * @return list of $beanClass * @throws RuntimeDaoException */ public java.util.List loadByPrimaryKey(java.util.Collection<${pk.javaType}> keys)throws RuntimeDaoException; #end##1 == $table.countPrimaryKeys() //2 /** * Delete row according to its primary keys.
* all keys must not be null * #foreach ( $pk in $primaryKeys ) * @param $pk.getVarName() ${pk.javaType} - PK# $velocityCount #end * @return the number of deleted rows * @throws RuntimeDaoException */ public int deleteByPrimaryKey(#join($primaryKeys "${e.javaType} ${e.varName}" ','))throws RuntimeDaoException; #if ( 1 == $table.countPrimaryKeys() ) #set ($pk = $table.getPrimaryKey()) //2.2 /** * Delete rows according to primary key.
* * @param keys primary keys array * @return the number of deleted rows * @throws RuntimeDaoException * @see ${esc.hash}delete(gu.sql2java.BaseBean) */ public int deleteByPrimaryKey(${pk.javaType}... keys)throws RuntimeDaoException; //2.3 /** * Delete rows according to primary key.
* * @param keys primary keys collection * @return the number of deleted rows * @throws RuntimeDaoException * @see ${esc.hash}delete(gu.sql2java.BaseBean) */ public int deleteByPrimaryKey(java.util.Collection<${pk.javaType}> keys)throws RuntimeDaoException; #end##1 == $table.countPrimaryKeys() #end ## $table.countPrimaryKeys() > 0 ## ====================================================== ## xImportedKeys template ## ====================================================== #foreach ($importedTable in $importedTables) #if ( $velocityCount == 1 ) ////////////////////////////////////// // GET/SET IMPORTED KEY BEAN METHOD ////////////////////////////////////// #end #set ( $importedClass = "$importedTable.asBeanClassNSP()" ) #set ( $importedNative = "$importedTable.asBeanClass()" ) #set ( $importedClassManager = "$importedTable.asManagerInterfaceNSP()" ) #foreach( $fkName in $importedTable.getFkMapNames($table.name) ) #set ( $columnsOfFk = $importedTable.getForeignKeysByFkName($fkName) ) //3.1 GET IMPORTED /** * Retrieves the {@link $importedClass} object from the #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME : $fkName * @param bean the {@link $beanClass} * @return the associated {@link $importedClass} beans or {@code null} if {@code bean} is {@code null} * @throws RuntimeDaoException */ public ${importedClass}[] ${importedTable.getImportedBeansGetMethod($fkName)}(B bean)throws RuntimeDaoException; //3.1.2 GET IMPORTED /** * Retrieves the {@link $importedClass} object from the #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME : $fkName #foreach ( $pk in $primaryKeys ) * @param $pk.getFullVarName() ${pk.javaType} - PK# $velocityCount #end * @return the associated {@link $importedClass} beans or {@code null} if {@code bean} is {@code null} * @throws RuntimeDaoException */ public ${importedClass}[] ${importedTable.getImportedBeansGetMethod($fkName)}(#join($primaryKeys "${e.javaType} $e.getFullVarName()" ','))throws RuntimeDaoException; //3.2 GET IMPORTED /** * see also ${esc.hash}${importedTable.getImportedBeansGetMethod($fkName)}AsList(B,int,int) * @param bean * @return import bean list * @throws RuntimeDaoException */ public java.util.List ${importedTable.getImportedBeansGetMethod($fkName)}AsList(B bean)throws RuntimeDaoException; //3.2.2 GET IMPORTED /** * Retrieves the {@link $importedClass} object from #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME:$fkName #foreach ( $pk in $primaryKeys ) * @param $pk.getFullVarName() ${pk.javaType} - PK# $velocityCount #end * @return the associated {@link $importedClass} beans * @throws RuntimeDaoException */ public java.util.List ${importedTable.getImportedBeansGetMethod($fkName)}AsList(#join($primaryKeys "${e.javaType} $e.getFullVarName()" ','))throws RuntimeDaoException; //3.2.3 DELETE IMPORTED /** * delete the associated {@link $importedClass} objects from #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME:$fkName #foreach ( $pk in $primaryKeys ) * @param $pk.getFullVarName() ${pk.javaType} - PK# $velocityCount #end * @return the number of deleted rows * @throws RuntimeDaoException */ public int ${importedTable.getImportedBeansDelMethod($fkName)}(#join($primaryKeys "${e.javaType} $e.getFullVarName()" ','))throws RuntimeDaoException; //3.2.4 GET IMPORTED /** * Retrieves the {@link $importedClass} object from #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME:$fkName * @param bean the {@link $beanClass} * @param startRow the start row to be used (first row = 1, last row=-1) * @param numRows the number of rows to be retrieved (all rows = a negative number) * @return the associated {@link $importedClass} beans or empty list if {@code bean} is {@code null} * @throws RuntimeDaoException */ public java.util.List ${importedTable.getImportedBeansGetMethod($fkName)}AsList(B bean,int startRow,int numRows)throws RuntimeDaoException; //3.3 SET IMPORTED /** * set the {@link $importedClass} object array associate to $beanClass by the #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME : $fkName * @param bean the referenced {@link $beanClass} * @param importedBeans imported beans from $importedTable.name * @return importedBeans always * @see ${importedClassManager}#$importedTable.getReferencedVarSetMethod($fkName)($importedClass, $beanClass) * @throws RuntimeDaoException */ public ${importedClass}[] ${importedTable.getImportedBeansSetMethod($fkName)}(B bean , ${importedClass}[] importedBeans)throws RuntimeDaoException; //3.4 SET IMPORTED /** * set the {@link $importedClass} object java.util.Collection associate to $beanClass by the #join($columnsOfFk "$e.fullName" ",") field.
* FK_NAME:$fkName * @param bean the referenced {@link $beanClass} * @param importedBeans imported beans from $importedTable.name * @return importedBeans always * @see ${importedClassManager}#$importedTable.getReferencedVarSetMethod($fkName)($importedClass, $beanClass) * @throws RuntimeDaoException */ public > C ${importedTable.getImportedBeansSetMethod($fkName)}(B bean , C importedBeans)throws RuntimeDaoException; #end #end###foreach ($importedTable in $importedTables) ## ====================================================== ## only xImportedKeys template ## ====================================================== #if( $table.hasForeignTables() || $table.hasImportedTables() ) //3.5 SYNC SAVE /** * Save the $beanClass bean and referenced beans and imported beans into the database. * * @param bean the {@link $beanClass} bean to be saved #foreachForeignTables($table " * @param $table.asRefArg($m_fkName) the {@link $m_foreignClass} bean referenced by {@link $beanClass} " ' ' 'true') #foreachImportedTables($table " * @param $m_importedTable.asImpArg($m_fkName) the {@link $m_importedClass} bean refer to {@link $beanClass} " ' ' 'true' ) * @return the inserted or updated {@link $beanClass} bean * @throws RuntimeDaoException */ public <#foreachAccociatedTables($table "$m_accociated_T extends $m_accociatedClass" ',')> B save(B bean #foreachForeignTables($table ", $m_foreign_T $table.asRefArg($m_fkName) " '' '') #foreachImportedTables($table ", ${m_imported_T}[] $m_importedTable.asImpArg($m_fkName) " '' ''))throws RuntimeDaoException; //3.6 SYNC SAVE AS TRANSACTION /** * Transaction version for sync save
* see also {@link ${esc.hash}save(${beanClass} #foreachForeignTables(${table} ", ${m_foreignClass} " '' '')#foreachImportedTables(${table} ", ${m_importedClass}[] " '' ''))} * @param bean the {@link $beanClass} bean to be saved #foreachForeignTables($table " * @param $table.asRefArg($m_fkName) the {@link $m_foreignClass} bean referenced by {@link $beanClass} " ' ' 'true') #foreachImportedTables($table " * @param $m_importedTable.asImpArg($m_fkName) the {@link $m_importedClass} bean refer to {@link $beanClass} " ' ' 'true' ) * @return the inserted or updated {@link $beanClass} bean * @throws RuntimeDaoException */ public <#foreachAccociatedTables($table "$m_accociated_T extends $m_accociatedClass" ',')> B saveAsTransaction(final B bean #foreachForeignTables($table ",final $m_foreign_T $table.asRefArg($m_fkName) " '' '') #foreachImportedTables($table ",final ${m_imported_T}[] $m_importedTable.asImpArg($m_fkName) " '' ''))throws RuntimeDaoException; #if( $table.hasImportedTables() ) //3.7 SYNC SAVE /** * Save the $beanClass bean and referenced beans and imported beans into the database. * * @param bean the {@link $beanClass} bean to be saved #foreachForeignTables($table " * @param $table.asRefArg($m_fkName) the {@link $m_foreignClass} bean referenced by {@link $beanClass} " ' ' 'true') #foreachImportedTables($table " * @param $m_importedTable.asImpArg($m_fkName) the {@link $m_importedClass} bean refer to {@link $beanClass} " ' ' 'true' ) * @return the inserted or updated {@link $beanClass} bean * @throws RuntimeDaoException */ public <#foreachAccociatedTables($table "$m_accociated_T extends $m_accociatedClass" ',')> B save(B bean #foreachForeignTables($table ", $m_foreign_T $table.asRefArg($m_fkName) " '' '') #foreachImportedTables($table ", java.util.Collection<$m_imported_T> $m_importedTable.asImpArg($m_fkName) " '' ''))throws RuntimeDaoException; //3.8 SYNC SAVE AS TRANSACTION /** * Transaction version for sync save
* see also {@link ${esc.hash}save($beanClass #foreachForeignTables($table ", $m_foreignClass " '' '')#foreachImportedTables($table ", java.util.Collection " '' ''))} * @param bean the {@link $beanClass} bean to be saved #foreachForeignTables($table " * @param $table.asRefArg($m_fkName) the {@link $m_foreignClass} bean referenced by {@link $beanClass} " ' ' 'true') #foreachImportedTables($table " * @param $m_importedTable.asImpArg($m_fkName) the {@link $m_importedClass} bean refer to {@link $beanClass} " ' ' 'true' ) * @return the inserted or updated {@link $beanClass} bean * @throws RuntimeDaoException */ public <#foreachAccociatedTables($table "$m_accociated_T extends $m_accociatedClass" ',')> B saveAsTransaction(final B bean #foreachForeignTables($table ",final $m_foreign_T $table.asRefArg($m_fkName) " '' '') #foreachImportedTables($table ",final java.util.Collection<$m_imported_T> $m_importedTable.asImpArg($m_fkName) " '' ''))throws RuntimeDaoException; #end ## $table.hasImportedTables() #end ## $table.hasForeignTables() || $table.hasImportedTables() ## ====================================================== ## xForeignKeys template ## ====================================================== #foreach ($foreignTable in $foreignTables) #if ( $velocityCount == 1 ) ////////////////////////////////////// // GET/SET FOREIGN KEY BEAN METHOD ////////////////////////////////////// #end #set ( $foreignClass = "$foreignTable.asConstantVar()_T" ) #set ( $foreignNative = "$foreignTable.asBeanClassNSP()" ) #foreach( $fkName in $table.getFkMapNames($foreignTable.name) ) #set ( $columnsOfFk = $table.getForeignKeysByFkName($fkName) ) //5.1 GET REFERENCED VALUE /** * Retrieves the {@link $foreignNative} object referenced by #join($columnsOfFk "{@link $beanClass#$e.getGetMethod()}()" ",") field.
* FK_NAME : $fkName * @param bean the {@link $beanClass} * @return the associated {@link $foreignNative} bean or {@code null} if {@code bean} is {@code null} * @throws RuntimeDaoException */ public <$foreignClass extends $foreignNative> $foreignClass $table.getReferencedVarGetMethod($fkName)(B bean)throws RuntimeDaoException; //5.2 SET REFERENCED /** * Associates the {@link $beanClass} object to the {@link $foreignNative} object by #join($columnsOfFk "{@link $beanClass#$e.getGetMethod()}()" ",") field. * * @param bean the {@link $beanClass} object to use * @param beanToSet the {@link $foreignNative} object to associate to the {@link $beanClass} * @return always beanToSet saved * @throws RuntimeDaoException */ public <$foreignClass extends $foreignNative> $foreignClass $table.getReferencedVarSetMethod($fkName)(B bean, $foreignClass beanToSet)throws RuntimeDaoException; #end #end #if ($table.countIndices() > 0) //_____________________________________________________________________ // // USING INDICES //_____________________________________________________________________ #foreach ( $index in $table.getIndices() ) #set( $indexColumns = $index.getIndexColumnsList()) #if($index.isUnique()) /** * Retrieves an unique $beanClass using the ${index.getName()} index. * #join($indexColumns " * @param ${e.getVarName()} the ${e.getName()} column's value filter" '') * @return an $beanClass,otherwise null if not found or exists null in input arguments * @throws RuntimeDaoException */ public B loadBy${index.asCamelCaseName()}(#join( $indexColumns "${e.javaType} ${e.getVarName()}" ','))throws RuntimeDaoException; /** * Retrieves an unique $beanClass using the ${index.getName()} index. * #join($indexColumns " * @param ${e.getVarName()} the ${e.getName()} column's value filter. must not be null" '') * @return an $beanClass * @throws NullPointerException exists null in input arguments * @throws ObjectRetrievalException if not found * @throws RuntimeDaoException */ public B loadBy${index.asCamelCaseName()}Checked(#join( $indexColumns "${e.javaType} ${e.getVarName()}" ','))throws RuntimeDaoException,ObjectRetrievalException; #if( 1 == $indexColumns.size()) #set ($indexColumn = $indexColumns.get(0)) /** * Retrieves an unique $beanClass for each ${index.getName()} index. * * @param indexs index array * @return an list of $beanClass * @throws RuntimeDaoException */ public java.util.List loadBy${index.asCamelCaseName()}(${indexColumn.javaType}... indexs)throws RuntimeDaoException; /** * Retrieves an unique $beanClass for each ${index.getName()} index. * * @param indexs index collection * @return an list of $beanClass * @throws RuntimeDaoException */ public java.util.List loadBy${index.asCamelCaseName()}(java.util.Collection<${indexColumn.javaType}> indexs)throws RuntimeDaoException; /** * Deletes rows for each ${index.getName()} index. * * @param indexs index array * @return the number of deleted rows * @throws RuntimeDaoException */ public int deleteBy${index.asCamelCaseName()}(${indexColumn.javaType}... indexs)throws RuntimeDaoException; /** * Deletes rows for each ${index.getName()} index. * * @param indexs index collection * @return the number of deleted rows * @throws RuntimeDaoException */ public int deleteBy${index.asCamelCaseName()}(java.util.Collection<${indexColumn.javaType}> indexs)throws RuntimeDaoException; #end##1 == $indexColumns.size() #else ## $index.isUnique() /** * Retrieves an array of $beanClass using the ${index.getName()} index. * #foreach ( $column in $index.getIndexColumnsList() ) * @param ${column.getVarName()} the ${column.getName()} column's value filter. #end * @return an array of $beanClass * @throws RuntimeDaoException */ public B[] loadBy${index.asCamelCaseName()}(#join( $index.getIndexColumnsList() "${e.javaType} ${e.getVarName()}" ','))throws RuntimeDaoException; /** * Retrieves a list of $beanClass using the ${index.getName()} index. * #foreach ( $column in $index.getIndexColumnsList() ) * @param ${column.getVarName()} the ${column.getName()} column's value filter. #end * @return a list of $beanClass * @throws RuntimeDaoException */ public java.util.List loadBy${index.asCamelCaseName()}AsList(#join( $index.getIndexColumnsList() "${e.javaType} ${e.getVarName()}" ','))throws RuntimeDaoException; #end## $index.isUnique() /** * Deletes rows using the ${index.getName()} index. * #foreach ( $column in $index.getIndexColumnsList() ) * @param ${column.getVarName()} the ${column.getName()} column's value filter. #end * @return the number of deleted objects * @throws RuntimeDaoException */ public int deleteBy${index.asCamelCaseName()}(#join( $index.getIndexColumnsList() "${e.javaType} ${e.getVarName()}" ','))throws RuntimeDaoException; #end #end##($table.countIndices() > 0) #if ( 1 == $table.countPrimaryKeys() ) #set ($pk = $table.getPrimaryKey()) //45 /** * return a primary key list from {@link $beanClass} array * @param beans * @return primary key list */ @SuppressWarnings("unchecked") public java.util.List<${pk.javaType}> toPrimaryKeyList(B... beans); //46 /** * return a primary key list from {@link $beanClass} collection * @param beans * @return primary key list */ public java.util.List<${pk.javaType}> toPrimaryKeyList(java.util.Collection beans); #end##1 == $table.countPrimaryKeys() #set ( $jTables = $table.getJunctionTables() ) #foreach ( $jTable in $jTables ) #set ( $linkedTable = $jTable.tableOfJunction( $table) ) #if ( $velocityCount == 1) //_____________________________________________________________________ // // MANY TO MANY: LOAD OTHER BEAN VIA JUNCTION TABLE //_____________________________________________________________________ #end #set ( $junctionBeanClass = $jTable.asBeanClass($isGeneral)) #set ( $junctionManagerClass = ${jTable.asManagerClass($isGeneral)}) #set ( $linkedBean = "${linkedTable.asBeanClass($isGeneral)}" ) #set ( $linkedCore = "${linkedTable.asCoreClass(true)}" ) #set ( $localFk = $jTable.getForeignKeys($table)[0]) #set ( $linkedFk = $jTable.getForeignKeys($linkedTable)[0]) #set ( $linkManagerClass = ${linkedTable.asManagerClass($isGeneral)}) //22 MANY TO MANY /** * see also ${esc.hash}$jTable.getLoadMethodOfJunction()AsList($table.asBeanClassNSP(),int,int) * @param bean * @return ${beanClass} list * @throws RuntimeDaoException */ public java.util.List $jTable.getLoadMethodOfJunction()AsList($linkedBean bean)throws RuntimeDaoException; //23 MANY TO MANY /** * Retrieves an list of $beanClass using the junction table ${jTable.asCoreClass($isGeneral)}, given a $linkedBean, * specifying the start row and the number of rows. * * @param bean the $linkedBean bean to be used * @param startRow the start row to be used (first row = 1, last row = -1) * @param numRows the number of rows to be retrieved (all rows = a negative number) * @return a list of $beanClass * @throws RuntimeDaoException */ public java.util.List $jTable.getLoadMethodOfJunction()AsList($linkedBean bean, int startRow, int numRows)throws RuntimeDaoException; #define($junctionParam) #join($jTable.primaryKeys '#set( $fColumn = $e.foreignColumn)#if($fColumn.table == $table)bean#{else}linked#{end}.$fColumn.getGetMethod()()' ',') #end //23.2 MANY TO MANY /** * add junction between {@link $beanClass} and {@link $linkedBean} if junction not exists * @param bean * @param linked * @throws RuntimeDaoException */ public void addJunction(B bean,$linkedBean linked)throws RuntimeDaoException; //23.3 MANY TO MANY /** * remove junction between {@link $beanClass} and {@link $linkedBean} * @param bean * @param linked * @return deleted rows count * @throws RuntimeDaoException */ public int deleteJunction(B bean,$linkedBean linked)throws RuntimeDaoException; //23.4 MANY TO MANY /** * see also {@link ${esc.hash}addJunction($beanClass,$linkedBean)} * @param bean * @param linkedBeans * @throws RuntimeDaoException */ public void addJunction(B bean,$linkedBean... linkedBeans)throws RuntimeDaoException; //23.5 MANY TO MANY /** * see also {@link ${esc.hash}addJunction($table.asBeanClassNSP(),$linkedBean)} * @param bean * @param linkedBeans * @throws RuntimeDaoException */ public void addJunctionWith${linkedCore}(B bean,java.util.Collection<$linkedBean> linkedBeans)throws RuntimeDaoException; //23.6 MANY TO MANY /** * see also {@link ${esc.hash}deleteJunction($table.asBeanClassNSP(),$linkedBean)} * @param bean * @param linkedBeans * @return count of deleted rows * @throws RuntimeDaoException */ public int deleteJunction(B bean,$linkedBean... linkedBeans)throws RuntimeDaoException; //23.7 MANY TO MANY /** * see also {@link ${esc.hash}deleteJunction($table.asBeanClassNSP(),$linkedBean)} * @param bean * @param linkedBeans * @return count of deleted rows * @throws RuntimeDaoException */ public int deleteJunctionWith${linkedCore}(B bean,java.util.Collection<$linkedBean> linkedBeans)throws RuntimeDaoException; #end ################### method for self-reference field################# #foreach($selfFk in $table.selfRefKeys) #if($velocityCount == 1) //_____________________________________________________________________ // // SELF-REFERENCE //_____________________________________________________________________ #end //47 /** * return bean list ( include bean specified by primary keys ) by the self-reference field : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) }
* first element is top bean * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @return empty list if input primary key is {@code null}
* first element equal last if self-reference field is cycle * @throws RuntimeDaoException */ public java.util.List $table.getListMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //48 /** * see also {@link ${esc.hash}$table.getListMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param bean * @return $beanClass list * @throws RuntimeDaoException */ public java.util.List $table.getListMethod($selfFk)(B bean)throws RuntimeDaoException; //49 /** * get level count on the self-reference field : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) } * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @return 0 if input primary key is {@code null}
* -1 if self-reference field is cycle * @throws RuntimeDaoException */ public int $table.getLevelMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //50 /** * see also {@link ${esc.hash}$table.getLevelMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param bean * @return level count * @throws RuntimeDaoException */ public int $table.getLevelMethod($selfFk)(B bean)throws RuntimeDaoException; //51 /** * test whether the self-reference field is cycle : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) } * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @see ${esc.hash}$table.getLevelMethod($selfFk)($table.asBeanClassNSP()) * @return true if the self-reference field is cycle * @throws RuntimeDaoException */ public boolean $table.getCyeleTestMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //52 /** * test whether the self-reference field is cycle : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) } * @param bean * @return true if the self-reference field is cycle * @throws RuntimeDaoException * @see ${esc.hash}$table.getLevelMethod($selfFk)($table.asBeanClassNSP()) */ public boolean $table.getCyeleTestMethod($selfFk)(B bean)throws RuntimeDaoException; //53 /** * return top bean that with {@code null} self-reference field : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) } * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @return top bean * @throws NullPointerException if input primary key is {@code null} * @throws IllegalStateException if self-reference field is cycle * @throws ObjectRetrievalException not found record by primary key * @throws RuntimeDaoException */ public B $table.getTopMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //54 /** * see also {@link ${esc.hash}$table.getTopMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param bean * @return top bean * @throws NullPointerException if input primary key is {@code null} * @throws IllegalStateException if self-reference field is cycle * @throws ObjectRetrievalException not found record by primary key * @throws RuntimeDaoException */ public B $table.getTopMethod($selfFk)(B bean)throws RuntimeDaoException; #if($table.countPrimaryKeys() == 1) //55 /** * Ensures the self-reference field is not cycle : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) } * @param $table.primaryKey.getVarName() PK# $velocityCount * @return always {@code $table.primaryKey.getVarName()} * @throws IllegalStateException if self-reference field is cycle * @throws RuntimeDaoException * @see ${esc.hash}$table.getCyeleTestMethod($selfFk)(${table.primaryKey.javaType}) */ public ${table.primaryKey.javaType} $table.getCheckNotCycleMethod($selfFk)(${table.primaryKey.javaType} $table.primaryKey.getVarName())throws RuntimeDaoException; #end //56 /** * Ensures the self-reference field is not cycle : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) }
* @param bean * @return always {@code bean} * @throws IllegalStateException if self-reference field is cycle * @throws RuntimeDaoException * @see ${esc.hash}$table.getCyeleTestMethod($selfFk)(${table.asBeanClassNSP()}) */ public B $table.getCheckNotCycleMethod($selfFk)(B bean)throws RuntimeDaoException; //57 /** * return child bean list (self included) by the self-reference field : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) }
* throw {@link RuntimeDaoException} if self-reference field is cycle * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @return child bean list,empty list if not found record * @throws IllegalStateException if self-reference field is cycle * @throws RuntimeDaoException */ public java.util.List $table.getChildListMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //58 /** * see also {@link ${esc.hash}$table.getChildListMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param bean * @return child bean list,empty list if not found record * @throws RuntimeDaoException */ public java.util.List $table.getChildListMethod($selfFk)(B bean)throws RuntimeDaoException; //59 /** * return child bean list (self included) by the self-reference field : {@code ${table.name}(#join($selfFk.columns '$e.name' ',')) }
* throw {@link RuntimeDaoException} if self-reference field is cycle * #join($primaryKeys '@param ${e.varName} PK# $velocityCount ' ' ') * @return child bean LinkedHashSet,empty if not found record * @throws IllegalStateException if self-reference field is cycle * @throws RuntimeDaoException */ public java.util.LinkedHashSet $table.getChildrenMethod($selfFk)(#join($primaryKeys '${e.javaType} ${e.varName}' ','))throws RuntimeDaoException; //60 /** * see also {@link ${esc.hash}$table.getChildrenMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param bean * @return child bean LinkedHashSet,empty if not found record * @throws RuntimeDaoException */ public java.util.LinkedHashSet $table.getChildrenMethod($selfFk)(B bean)throws RuntimeDaoException; #if($table.countPrimaryKeys() == 1) //61 /** * see also {@link ${esc.hash}$table.getChildrenMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param beans * @return child bean LinkedHashSet,empty if not found record * @throws RuntimeDaoException */ public java.util.LinkedHashSet $table.getChildrenOfBeansMethod($selfFk)(Iterable beans)throws RuntimeDaoException; //62 /** * see also {@link ${esc.hash}$table.getChildrenMethod($selfFk)(#join($primaryKeys '${e.javaType}' ','))} * @param pks * @return child bean LinkedHashSet,empty if not found record * @throws RuntimeDaoException */ public java.util.LinkedHashSet $table.getChildrenOfPksMethod($selfFk)(Iterable<${table.primaryKey.javaType}> pks)throws RuntimeDaoException; #end #end }