${database.allClassCopyright}package ${glPackageBaseCB}; #set ($myClassName = "${myBaseConditionBeanClassName}") import org.seasar.dbflute.cbean.AbstractConditionBean; import org.seasar.dbflute.cbean.AndQuery; import org.seasar.dbflute.cbean.ConditionBean; import org.seasar.dbflute.cbean.ConditionQuery; import org.seasar.dbflute.cbean.OrQuery; import org.seasar.dbflute.cbean.SpecifyQuery; import org.seasar.dbflute.cbean.SubQuery; import org.seasar.dbflute.cbean.UnionQuery; import org.seasar.dbflute.cbean.chelper.*; import org.seasar.dbflute.cbean.coption.*; import org.seasar.dbflute.cbean.sqlclause.SqlClause; import org.seasar.dbflute.cbean.sqlclause.SqlClauseCreator; import org.seasar.dbflute.dbmeta.DBMetaProvider; import org.seasar.dbflute.twowaysql.factory.SqlAnalyzerFactory; #if ($table.hasPrimaryKeyForcedClassificationSetting()) import ${glPackageBaseCommon}.${glCDef}; #end import ${glPackageBaseCommon}.${glDBFluteConfig}; import ${glPackageBaseCommon}.${glDBMetaInstanceHandler}; import ${glPackageBaseCommon}.${glImplementedInvokerAssistant}; import ${glPackageBaseCommon}.${glImplementedSqlClauseCreator}; import ${glPackageCB}.*; import ${glPackageCQ}.*; #if ($table.hasForeignKeyOrReferrerAsOne()) import ${glPackageNss}.*; #end /** * The base condition-bean of ${table.name}. * @author ${database.classAuthor} */ public class ${myClassName} extends AbstractConditionBean { // =================================================================================== // Attribute // ========= protected ${myConditionQueryClassName} _conditionQuery; // =================================================================================== // SqlClause // ========= @Override protected SqlClause createSqlClause() { SqlClauseCreator creator = ${glDBFluteConfig}.getInstance().getSqlClauseCreator(); if (creator != null) { return creator.createSqlClause(this); } return new ${glImplementedSqlClauseCreator}().createSqlClause(this); // as default } // =================================================================================== // DBMeta Provider // =============== @Override protected DBMetaProvider getDBMetaProvider() { return ${glDBMetaInstanceHandler}.getProvider(); // as default } // =================================================================================== // Table Name // ========== public String getTableDbName() { return "${table.name}"; } // =================================================================================== // PrimaryKey Handling // =================== #if ($table.hasPrimaryKey()) public void acceptPrimaryKey(${table.primaryKeyArgsString}) { ${table.primaryKeyArgsAssertString} ${myClassName} cb = this; ${table.primaryKeyArgsConditionSetupString} } #end public ConditionBean addOrderBy_PK_Asc() { #if ($table.hasPrimaryKey()) #foreach ($col in $table.primaryKey) query().addOrderBy_${col.JavaName}_Asc(); #end return this; #else String msg = "The table has no primary-keys: " + getTableDbName(); throw new UnsupportedOperationException(msg); #end } public ConditionBean addOrderBy_PK_Desc() { #if ($table.hasPrimaryKey()) #foreach ($col in $table.primaryKey) query().addOrderBy_${col.JavaName}_Desc(); #end return this; #else String msg = "The table has no primary-keys: " + getTableDbName(); throw new UnsupportedOperationException(msg); #end } // =================================================================================== // Query // ===== /** * Prepare for various queries.
* Examples of main functions are following: *
     * // Basic Queries
     * cb.query().setMemberId_Equal(value);        // =
     * cb.query().setMemberId_NotEqual(value);     // !=
     * cb.query().setMemberId_GreaterThan(value);  // >
     * cb.query().setMemberId_LessThan(value);     // <
     * cb.query().setMemberId_GreaterEqual(value); // >=
     * cb.query().setMemberId_LessEqual(value);    // <=
     * cb.query().setMemberName_InScope(valueList);    // in ('a', 'b')
     * cb.query().setMemberName_NotInScope(valueList); // not in ('a', 'b')
     * cb.query().setMemberName_PrefixSearch(value);   // like 'a%' escape '|'
     * // LikeSearch with various options: (versatile)
     * // {like ... [options]}
     * cb.query().setMemberName_LikeSearch(value, option);
     * cb.query().setMemberName_NotLikeSearch(value, option); // not like ...
     * // FromTo with various options: (versatile)
     * // {(default) fromDatetime <= BIRTHDATE <= toDatetime}
     * cb.query().setBirthdate_FromTo(fromDatetime, toDatetime, option);
     * // DateFromTo: (Date means yyyy/MM/dd)
     * // {fromDate <= BIRTHDATE < toDate + 1 day}
     * cb.query().setBirthdate_DateFromTo(fromDate, toDate);
     * cb.query().setBirthdate_IsNull();    // is null
     * cb.query().setBirthdate_IsNotNull(); // is not null
     * 
     * // ExistsReferrer: (co-related sub-query)
     * // {where exists (select PURCHASE_ID from PURCHASE where ...)}
     * cb.query().existsPurchaseList(new SubQuery<PurchaseCB>() {
     *     public void query(PurchaseCB subCB) {
     *         subCB.query().setXxx... // referrer sub-query condition
     *     }
     * });
     * cb.query().notExistsPurchaseList...
     * 
     * // InScopeRelation: (sub-query)
     * // {where MEMBER_STATUS_CODE in (select MEMBER_STATUS_CODE from MEMBER_STATUS where ...)}
     * cb.query().inScopeMemberStatus(new SubQuery<MemberStatusCB>() {
     *     public void query(MemberStatusCB subCB) {
     *         subCB.query().setXxx... // relation sub-query condition
     *     }
     * });
     * cb.query().notInScopeMemberStatus...
     * 
     * // (Query)DerivedReferrer: (co-related sub-query)
     * cb.query().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
     *     public void query(PurchaseCB subCB) {
     *         subCB.specify().columnPurchasePrice(); // derived column for function
     *         subCB.query().setXxx... // referrer sub-query condition
     *     }
     * }).greaterEqual(value);
     * 
     * // ScalarCondition: (self-table sub-query)
     * cb.query().scalar_Equal().max(new SubQuery<MemberCB>() {
     *     public void query(MemberCB subCB) {
     *         subCB.specify().columnBirthdate(); // derived column for function
     *         subCB.query().setXxx... // scalar sub-query condition
     *     }
     * });
     * 
     * // OrderBy
     * cb.query().addOrderBy_MemberName_Asc();
     * cb.query().addOrderBy_MemberName_Desc().withManualOrder(valueList);
     * cb.query().addOrderBy_MemberName_Desc().withNullsFirst();
     * cb.query().addOrderBy_MemberName_Desc().withNullsLast();
     * cb.query().addSpecifiedDerivedOrderBy_Desc(aliasName);
     * 
     * // Query(Relation)
     * cb.query().queryMemberStatus()...;
     * cb.query().queryMemberAddressAsValid(targetDate)...;
     * 
* @return The instance of condition-query for base-point table to set up query. (NotNull) */ public ${myConditionQueryClassName} query() { assertQueryPurpose(); // assert only when user-public query return getConditionQuery(); } public ${myConditionQueryClassName} getConditionQuery() { // public for parameter comment and internal if (_conditionQuery == null) { _conditionQuery = createLocalCQ(); } return _conditionQuery; } protected ${myConditionQueryClassName} createLocalCQ() { return xcreateCQ(null, getSqlClause(), getSqlClause().getBasePointAliasName(), 0); } protected ${myConditionQueryClassName} xcreateCQ(ConditionQuery childQuery, SqlClause sqlClause, String aliasName, int nestLevel) { return new ${myConditionQueryClassName}(childQuery, sqlClause, aliasName, nestLevel); } public ConditionQuery localCQ() { return getConditionQuery(); } // =================================================================================== // Union // ===== /** * Set up 'union' for base-point table.
* You don't need to call SetupSelect in union-query, * because it inherits calls before. (Don't call SetupSelect after here) *
     * cb.query().union(new UnionQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} unionCB) {
     *         unionCB.query().setXxx...
     *     }
     * });
     * 
* @param unionQuery The query of 'union'. (NotNull) */ public void union(UnionQuery<${myConditionBeanClassName}> unionQuery) { final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}(); cb.xsetupForUnion(this); xsyncUQ(cb); unionQuery.query(cb); final ${myConditionQueryClassName} cq = cb.query(); query().xsetUnionQuery(cq); } /** * Set up 'union all' for base-point table.
* You don't need to call SetupSelect in union-query, * because it inherits calls before. (Don't call SetupSelect after here) *
     * cb.query().unionAll(new UnionQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} unionCB) {
     *         unionCB.query().setXxx...
     *     }
     * });
     * 
* @param unionQuery The query of 'union all'. (NotNull) */ public void unionAll(UnionQuery<${myConditionBeanClassName}> unionQuery) { final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}(); cb.xsetupForUnion(this); xsyncUQ(cb); unionQuery.query(cb); final ${myConditionQueryClassName} cq = cb.query(); query().xsetUnionAllQuery(cq); } #if ($database.isAvailableDatabaseDependency()) #if ($database.isDatabasePostgreSQL()) // =================================================================================== // Lock Wait // ========= public ConditionBean lockForUpdateNoWait() { if (xhelpIsSqlClausePostgreSql()) { xhelpGettingSqlClausePostgreSql().lockForUpdateNoWait(); } return this; } protected boolean xhelpIsSqlClausePostgreSql() { return getSqlClause() instanceof org.seasar.dbflute.cbean.sqlclause.SqlClausePostgreSql; } protected org.seasar.dbflute.cbean.sqlclause.SqlClausePostgreSql xhelpGettingSqlClausePostgreSql() { return (org.seasar.dbflute.cbean.sqlclause.SqlClausePostgreSql)getSqlClause(); } #end #if ($database.isDatabaseOracle()) // =================================================================================== // Lock Wait // ========= public ConditionBean lockForUpdateNoWait() { if (xhelpIsSqlClauseOracle()) { xhelpGettingSqlClauseOracle().lockForUpdateNoWait(); } return this; } public ConditionBean lockForUpdateWait(int waitSec) { if (xhelpIsSqlClauseOracle()) { xhelpGettingSqlClauseOracle().lockForUpdateWait(waitSec); } return this; } protected boolean xhelpIsSqlClauseOracle() { return getSqlClause() instanceof org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle; } protected org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle xhelpGettingSqlClauseOracle() { return (org.seasar.dbflute.cbean.sqlclause.SqlClauseOracle)getSqlClause(); } #end #if ($database.isDatabaseDB2()) // [DBFlute-0.7.9] // =================================================================================== // Isolation Level // =============== // *Database Dependency public void lockWithRR() { if (xhelpIsSqlClauseDb2()) { xhelpGettingSqlClauseDb2().lockWithRR(); } } public void lockWithRS() { if (xhelpIsSqlClauseDb2()) { xhelpGettingSqlClauseDb2().lockWithRS(); } } public void lockWithCS() { if (xhelpIsSqlClauseDb2()) { xhelpGettingSqlClauseDb2().lockWithCS(); } } public void lockWithUR() { if (xhelpIsSqlClauseDb2()) { xhelpGettingSqlClauseDb2().lockWithUR(); } } protected boolean xhelpIsSqlClauseDb2() { return getSqlClause() instanceof org.seasar.dbflute.cbean.sqlclause.SqlClauseDb2; } protected org.seasar.dbflute.cbean.sqlclause.SqlClauseDb2 xhelpGettingSqlClauseDb2() { return (org.seasar.dbflute.cbean.sqlclause.SqlClauseDb2)getSqlClause(); } #end #end // =================================================================================== // SetupSelect // =========== #foreach ($fk in $table.foreignKeys) #set ($tmpPropertyName = "${fk.foreignPropertyName}") #set ($tmpPropertyNameInitCap = "${fk.foreignPropertyNameInitCap}") #set ($nestSelectSetuppperClassName = "${fk.foreignTableNestSelectSetupperClassName}") #set ($dynamicFixedConditionArgs = "") #set ($dynamicFixedConditionVariables = "") #if ($fk.hasDynamicFixedCondition()) #set ($dynamicFixedConditionArgs = "${fk.dynamicFixedConditionFinalArgs}") #set ($dynamicFixedConditionVariables = "${fk.dynamicFixedConditionVariables}") #end protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap}; public ${nestSelectSetuppperClassName} getNss${tmpPropertyNameInitCap}() { if (_nss${tmpPropertyNameInitCap} == null) { _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null); } return _nss${tmpPropertyNameInitCap}; } /** * Set up relation columns to select clause.
* ${fk.foreignDispForJavaDoc} *
     * ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
     * cb.setupSelect_${tmpPropertyNameInitCap}(${dynamicFixedConditionVariables}); // ...().with[nested-relation]()
     * cb.query().setFoo...(value);
     * ${myExtendedObjectClassName} ${myEntityVariableName} = ${myEntityVariableName}Bhv.selectEntityWithDeletedCheck(cb);
     * ... = ${myEntityVariableName}.get${tmpPropertyNameInitCap}(); // you can get by using SetupSelect
     * 
#if ($fk.hasDynamicFixedCondition()) * ${fk.dynamicFixedConditionArgsJavaDocString} #end * @return The set-upper of nested relation. {setupSelect...().with[nested-relation]} (NotNull) */ public ${nestSelectSetuppperClassName} setupSelect_${tmpPropertyNameInitCap}(${dynamicFixedConditionArgs}) { #if ($fk.hasLocalColumnExceptPrimaryKey()) if (hasSpecifiedColumn()) { // if reverse call #foreach ($col in $fk.localColumnList) #if (!$col.isPrimaryKey()) specify().column${col.javaName}(); #end #end } #end doSetupSelect(new SsCall() { public ConditionQuery qf() { return query().query${tmpPropertyNameInitCap}(${dynamicFixedConditionVariables}); } }); if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.hasConditionQuery()) { _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(query().query${tmpPropertyNameInitCap}(${dynamicFixedConditionVariables})); } return _nss${tmpPropertyNameInitCap}; } #end #foreach ($referrer in $table.referrerAsOneList) #set ($tmpPropertyName = "${referrer.referrerPropertyNameAsOne}") #set ($tmpPropertyNameInitCap = "${referrer.referrerPropertyNameInitCapAsOne}") #set ($nestSelectSetuppperClassName = "${referrer.referrerTableNestSelectSetupperClassName}") protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap}; public ${nestSelectSetuppperClassName} getNss${tmpPropertyNameInitCap}() { if (_nss${tmpPropertyNameInitCap} == null) { _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null); } return _nss${tmpPropertyNameInitCap}; } /** * Set up relation columns to select clause.
* ${referrer.referrerDispAsOneForJavaDoc} *
     * ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
     * cb.setupSelect_${tmpPropertyNameInitCap}(); // ...().with[nested-relation]()
     * cb.query().setFoo...(value);
     * ${myExtendedObjectClassName} ${myEntityVariableName} = ${myEntityVariableName}Bhv.selectEntityWithDeletedCheck(cb);
     * ... = ${myEntityVariableName}.get${tmpPropertyNameInitCap}(); // you can get by using SetupSelect
     * 
* @return The set-upper of nested relation. {setupSelect...().with[nested-relation]} (NotNull) */ public ${nestSelectSetuppperClassName} setupSelect_${tmpPropertyNameInitCap}() { doSetupSelect(new SsCall() { public ConditionQuery qf() { return query().query${tmpPropertyNameInitCap}(); } }); if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.hasConditionQuery()) { _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(query().query${tmpPropertyNameInitCap}()); } return _nss${tmpPropertyNameInitCap}; } #end // [DBFlute-0.7.4] // =================================================================================== // Specify // ======= protected HpSpecification _specification; /** * Prepare for SpecifyColumn, (Specify)DerivedReferrer.
* This method should be called after SetupSelect. *
     * cb.setupSelect_MemberStatus(); // should be called before specify()
     * cb.specify().columnMemberName();
     * cb.specify().specifyMemberStatus().columnMemberStatusName();
     * cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
     *     public void query(PurchaseCB subCB) {
     *         subCB.specify().columnPurchaseDatetime();
     *         subCB.query().set...
     *     }
     * }, aliasName);
     * 
* @return The instance of specification. (NotNull) */ public HpSpecification specify() { assertSpecifyPurpose(); if (_specification == null) { _specification = new HpSpecification(this , new HpSpQyCall<${myConditionQueryClassName}>() { public boolean has() { return true; } public ${myConditionQueryClassName} qy() { return getConditionQuery(); } } , _purpose, getDBMetaProvider()); } return _specification; } protected boolean hasSpecifiedColumn() { return _specification != null && _specification.isAlreadySpecifiedRequiredColumn(); } protected HpAbstractSpecification localSp() { return specify(); } public static class HpSpecification extends HpAbstractSpecification<${myConditionQueryClassName}> { #foreach ($fk in $table.foreignKeys) #set ($tmpPropertyName = "${fk.foreignPropertyName}") #set ($tmpCBClassName = "${fk.foreignTableExtendedConditionBeanClassName}") protected ${tmpCBClassName}.HpSpecification _${tmpPropertyName}; #end #foreach ($referrer in $table.referrerAsOneList) #set ($tmpPropertyName = "${referrer.referrerPropertyNameAsOne}") #set ($tmpCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}") protected ${tmpCBClassName}.HpSpecification _${tmpPropertyName}; #end public HpSpecification(ConditionBean baseCB, HpSpQyCall<${myConditionQueryClassName}> qyCall , HpCBPurpose purpose, DBMetaProvider dbmetaProvider) { super(baseCB, qyCall, purpose, dbmetaProvider); } #foreach ($col in $table.columns) /** ${col.aliasExpression}${col.name}: {${col.columnDefinitionLineDisp}} */ public void column${col.javaName}() { doColumn("${col.name}"); } #end @Override protected void doSpecifyRequiredColumn() { #foreach ($col in $table.primaryKey) column${col.javaName}(); // PK #end #foreach ($fk in $table.foreignKeys) #set ($tmpPropertyName = "${fk.foreignPropertyName}") #set ($tmpPropertyNameInitCap = "${fk.foreignPropertyNameInitCap}") #if ($fk.hasLocalColumnExceptPrimaryKey()) if (qyCall().qy().hasConditionQuery${tmpPropertyNameInitCap}() || qyCall().qy().xgetReferrerQuery() instanceof ${fk.foreignTableExtendedConditionQueryClassName}) { #foreach ($col in $fk.localColumnList) #if (!$col.isPrimaryKey()) column${col.javaName}(); // FK or one-to-one referrer #end #end } #end #end } @Override protected String getTableDbName() { return "$table.name"; } #foreach ($fk in $table.foreignKeys) #set ($tmpPropertyName = "${fk.foreignPropertyName}") #set ($tmpPropertyNameInitCap = "${fk.foreignPropertyNameInitCap}") #set ($tmpCBClassName = "${fk.foreignTableExtendedConditionBeanClassName}") #set ($tmpCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}") /** * Prepare to specify functions about relation table.
* ${fk.foreignDispForJavaDocNest} * @return The instance for specification for relation table to specify. (NotNull) */ public ${tmpCBClassName}.HpSpecification specify${tmpPropertyNameInitCap}() { assertRelation("${tmpPropertyName}"); if (_${tmpPropertyName} == null) { _${tmpPropertyName} = new ${tmpCBClassName}.HpSpecification(_baseCB, new HpSpQyCall<${tmpCQClassName}>() { public boolean has() { return _qyCall.has() && _qyCall.qy().hasConditionQuery${tmpPropertyNameInitCap}(); } #if ($fk.hasDynamicFixedCondition()) public ${tmpCQClassName} qy() { return _qyCall.qy().getConditionQuery${tmpPropertyNameInitCap}(); } } #else public ${tmpCQClassName} qy() { return _qyCall.qy().query${tmpPropertyNameInitCap}(); } } #end , _purpose, _dbmetaProvider); if (xhasSyncQyCall()) { // inherits it _${tmpPropertyName}.xsetSyncQyCall(new HpSpQyCall<${tmpCQClassName}>() { public boolean has() { return xsyncQyCall().has() && xsyncQyCall().qy().hasConditionQuery${tmpPropertyNameInitCap}(); } #if ($fk.hasDynamicFixedCondition()) public ${tmpCQClassName} qy() { return xsyncQyCall().qy().getConditionQuery${tmpPropertyNameInitCap}(); } #else public ${tmpCQClassName} qy() { return xsyncQyCall().qy().query${tmpPropertyNameInitCap}(); } #end }); } } return _${tmpPropertyName}; } #end #foreach ($referrer in $table.referrerAsOneList) #set ($tmpPropertyName = "${referrer.referrerPropertyNameAsOne}") #set ($tmpPropertyNameInitCap = "${referrer.referrerPropertyNameInitCapAsOne}") #set ($tmpCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}") #set ($tmpCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}") /** * Prepare to specify functions about relation table.
* ${referrer.referrerDispAsOneForJavaDocNest} * @return The instance for specification for relation table to specify. (NotNull) */ public ${tmpCBClassName}.HpSpecification specify${tmpPropertyNameInitCap}() { assertRelation("${tmpPropertyName}"); if (_${tmpPropertyName} == null) { _${tmpPropertyName} = new ${tmpCBClassName}.HpSpecification(_baseCB, new HpSpQyCall<${tmpCQClassName}>() { public boolean has() { return _qyCall.has() && _qyCall.qy().hasConditionQuery${tmpPropertyNameInitCap}(); } public ${tmpCQClassName} qy() { return _qyCall.qy().query${tmpPropertyNameInitCap}(); } } , _purpose, _dbmetaProvider); if (xhasSyncQyCall()) { // inherits it _${tmpPropertyName}.xsetSyncQyCall(new HpSpQyCall<${tmpCQClassName}>() { public boolean has() { return xsyncQyCall().has() && xsyncQyCall().qy().hasConditionQuery${tmpPropertyNameInitCap}(); } public ${tmpCQClassName} qy() { return xsyncQyCall().qy().query${tmpPropertyNameInitCap}(); } }); } } return _${tmpPropertyName}; } #end #foreach ($referrer in $table.singleKeyStringOrIntegerReferrers) #if (!${referrer.isOneToOne()}) #set ($tmpPropertyName = "${referrer.referrerPropertyName}") #set ($tmpPropertyNameInitCap = "${referrer.referrerPropertyNameInitCap}") #set ($tmpCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}") #set ($tmpLocalCQClassName = "${referrer.foreignTableExtendedConditionQueryClassName}") /** * Prepare for '(Specify)DerivedReferrer'.
* ${referrer.referrerDispForJavaDocNest} *
         * cb.specify().derived${tmpPropertyNameInitCap}().max(new SubQuery<${tmpCBClassName}>() {
         *     public void query(${tmpCBClassName} subCB) {
         *         subCB.specify().columnFoo... // derived column for function
         *         subCB.query().setBar... // referrer condition
         *     }
         * }, aliasName);
         * 
* @return The object to set up a function for referrer table. (NotNull) */ public HpSDRFunction<${tmpCBClassName}, ${tmpLocalCQClassName}> derived${tmpPropertyNameInitCap}() { assertDerived("${tmpPropertyName}"); if (xhasSyncQyCall()) { xsyncQyCall().qy(); } // for sync (for example, this in ColumnQuery) return new HpSDRFunction<${tmpCBClassName}, ${tmpLocalCQClassName}>(_baseCB, _qyCall.qy(), new HpSDRSetupper<${tmpCBClassName}, ${tmpLocalCQClassName}>() { public void setup(String function, SubQuery<${tmpCBClassName}> subQuery, ${tmpLocalCQClassName} cq, String aliasName, DerivedReferrerOption option) { cq.xsderive${referrer.referrerPropertyNameInitCap}(function, subQuery, aliasName, option); } }, _dbmetaProvider); } #end #end } // [DBFlute-0.9.5.3] // =================================================================================== // ColumnQuery // =========== /** * Set up column-query. {column1 = column2} *
     * // where FOO < BAR
     * cb.columnQuery(new SpecifyQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} cb) {
     *         cb.specify().columnFoo(); // left column
     *     }
     * }).lessThan(new SpecifyQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} cb) {
     *         cb.specify().columnBar(); // right column
     *     }
     * }); // you can calculate for right column like '}).plus(3);'
     * 
* @param leftSpecifyQuery The specify-query for left column. (NotNull) * @return The object for setting up operand and right column. (NotNull) */ public HpColQyOperand<${myConditionBeanClassName}> columnQuery(final SpecifyQuery<${myConditionBeanClassName}> leftSpecifyQuery) { return new HpColQyOperand<${myConditionBeanClassName}>(new HpColQyHandler<${myConditionBeanClassName}>() { public HpCalculator handle(SpecifyQuery<${myConditionBeanClassName}> rightSp, String operand) { return xcolqy(xcreateColumnQueryCB(), xcreateColumnQueryCB(), leftSpecifyQuery, rightSp, operand); } }); } protected ${myConditionBeanClassName} xcreateColumnQueryCB() { ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}(); cb.xsetupForColumnQuery((${myConditionBeanClassName})this); return cb; } // [DBFlute-0.9.6.3] // =================================================================================== // OrScopeQuery // ============ /** * Set up the query for or-scope.
* (Same-column-and-same-condition-key conditions are allowed in or-scope) *
     * // where (FOO = '...' or BAR = '...')
     * cb.orScopeQuery(new OrQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} orCB) {
     *         orCB.query().setFOO_Equal...
     *         orCB.query().setBAR_Equal...
     *     }
     * });
     * 
* @param orQuery The query for or-condition. (NotNull) */ public void orScopeQuery(OrQuery<${myConditionBeanClassName}> orQuery) { xorSQ((${myConditionBeanClassName})this, orQuery); } /** * Set up the and-part of or-scope.
* (However nested or-scope query and as-or-split of like-search in and-part are unsupported) *
     * // where (FOO = '...' or (BAR = '...' and QUX = '...'))
     * cb.orScopeQuery(new OrQuery<${myConditionBeanClassName}>() {
     *     public void query(${myConditionBeanClassName} orCB) {
     *         orCB.query().setFOO_Equal...
     *         orCB.orScopeQueryAndPart(new AndQuery<${myConditionBeanClassName}>() {
     *             public void query(${myConditionBeanClassName} andCB) {
     *                 andCB.query().setBar_...
     *                 andCB.query().setQux_...
     *             }
     *         });
     *     }
     * });
     * 
* @param andQuery The query for and-condition. (NotNull) */ public void orScopeQueryAndPart(AndQuery<${myConditionBeanClassName}> andQuery) { xorSQAP((${myConditionBeanClassName})this, andQuery); } // =================================================================================== // DisplaySQL // ========== @Override protected SqlAnalyzerFactory getSqlAnalyzerFactory() { return new ${glImplementedInvokerAssistant}().assistSqlAnalyzerFactory(); } @Override protected String getLogDateFormat() { return ${glDBFluteConfig}.getInstance().getLogDateFormat(); } @Override protected String getLogTimestampFormat() { return ${glDBFluteConfig}.getInstance().getLogTimestampFormat(); } // =================================================================================== // Basic Status Determination // ========================== public boolean hasUnionQueryOrUnionAllQuery() { return query().hasUnionQueryOrUnionAllQuery(); } // [DBFlute-0.7.4] // =================================================================================== // Purpose Type // ============ public void xsetupForColumnQuery(final ${myConditionBeanClassName} mainCB) { xinheritSubQueryInfo(mainCB.localCQ()); xchangePurposeSqlClause(HpCBPurpose.COLUMN_QUERY); // inherits a parent query to synchronize real name // (and also for suppressing query check) specify().xsetSyncQyCall(new HpSpQyCall<${myConditionQueryClassName}>() { public boolean has() { return true; } public ${myConditionQueryClassName} qy() { return mainCB.query(); } }); } public void xsetupForVaryingUpdate() { xchangePurposeSqlClause(HpCBPurpose.VARYING_UPDATE); // for suppressing query check final ${myConditionBeanClassName} nonCheckCB = new ${myConditionBeanClassName}(); specify().xsetSyncQyCall(new HpSpQyCall<${myConditionQueryClassName}>() { public boolean has() { return true; } public ${myConditionQueryClassName} qy() { return nonCheckCB.query(); } }); } // =================================================================================== // Internal // ======== // very internal (for suppressing warn about 'Not Use Import') protected String getConditionBeanClassNameInternally() { return ${myConditionBeanClassName}.class.getName(); } protected String getConditionQueryClassNameInternally() { return ${myConditionQueryClassName}.class.getName(); } protected String getSubQueryClassNameInternally() { return SubQuery.class.getName(); } protected String getConditionOptionClassNameInternally() { return ConditionOption.class.getName(); } }