${database.allClassCopyright}package ${glPackageBaseCQ};
#set ($myClassName = "${myBaseConditionQueryClassName}")
import java.util.Map;
import org.seasar.dbflute.cbean.*;
import org.seasar.dbflute.cbean.cvalue.ConditionValue;
import org.seasar.dbflute.cbean.sqlclause.SqlClause;
import org.seasar.dbflute.exception.IllegalConditionBeanOperationException;
import ${glPackageCIQ}.*;
import ${glPackageCB}.*;
import ${glPackageCQ}.*;
/**
* The base condition-query of ${table.name}.
* @author ${database.classAuthor}
*/
public class ${myClassName} extends ${myAbstractBaseConditionQueryClassName} {
// ===================================================================================
// Attribute
// =========
protected ${myConditionInlineQueryClassName} _inlineQuery;
// ===================================================================================
// Constructor
// ===========
public ${myClassName}(ConditionQuery childQuery, SqlClause sqlClause, String aliasName, int nestLevel) {
super(childQuery, sqlClause, aliasName, nestLevel);
}
// ===================================================================================
// Inline
// ======
/**
* Prepare InlineView query.
* {select ... from ... left outer join (select * from ${table.name}) where FOO = [value] ...}
*
* cb.query().queryMemberStatus().inline().setFoo...;
*
* @return The condition-query for InlineView query. (NotNull)
*/
public ${myConditionInlineQueryClassName} inline() {
if (_inlineQuery == null) { _inlineQuery = createInlineQuery(); }
_inlineQuery.xsetOnClause(false); return _inlineQuery;
}
protected ${myConditionInlineQueryClassName} createInlineQuery()
{ return new ${myConditionInlineQueryClassName}(xgetReferrerQuery(), xgetSqlClause(), xgetAliasName(), xgetNestLevel(), this); }
/**
* Prepare OnClause query.
* {select ... from ... left outer join ${table.name} on ... and FOO = [value] ...}
*
* cb.query().queryMemberStatus().on().setFoo...;
*
* @return The condition-query for OnClause query. (NotNull)
* @throws IllegalConditionBeanOperationException When this condition-query is base query.
*/
public ${myConditionInlineQueryClassName} on() {
if (isBaseQuery()) { throw new IllegalConditionBeanOperationException("OnClause for local table is unavailable!"); }
${myConditionInlineQueryClassName} inlineQuery = inline(); inlineQuery.xsetOnClause(true); return inlineQuery;
}
// ===================================================================================
// Query
// =====
#foreach ($col in $table.columns)
#set ($tmpJavaName = "${col.JavaName}")
#set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
#set ($fk = $col.foreignKey)
protected ConditionValue _${tmpUncapitalisedJavaName};
public ConditionValue get${tmpJavaName}() {
if (_${tmpUncapitalisedJavaName} == null) { _${tmpUncapitalisedJavaName} = nCV(); }
return _${tmpUncapitalisedJavaName};
}
protected ConditionValue getCValue${tmpJavaName}() { return get${tmpJavaName}(); }
#if (${col.isJavaNativeStringObject()})
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.isSingleKeyForeignKey()} && !${fk.hasFixedCondition()})
#set ($relatedCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${referrer.ReferrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${referrer.ReferrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.isSingleKeyForeignKey()} && !${fk.hasFixedCondition()})
#set ($relatedCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${referrer.ReferrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${referrer.ReferrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#if (!${referrer.isOneToOne()})
#set ($relatedCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}")
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_SpecifyDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_SpecifyDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#if (!${referrer.isOneToOne()})
#set ($relatedCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}")
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_QueryDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_QueryDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
protected Map _${subQueryPropertyName}ParameterMap;
public Map get${subQueryPropertyNameInitCap}Parameter() { return _${subQueryPropertyName}ParameterMap; }
public String keep${subQueryPropertyNameInitCap}Parameter(Object parameterValue) {
if (_${subQueryPropertyName}ParameterMap == null) { _${subQueryPropertyName}ParameterMap = newLinkedHashMap(); }
String key = "subQueryParameterKey" + (_${subQueryPropertyName}ParameterMap.size() + 1);
_${subQueryPropertyName}ParameterMap.put(key, parameterValue); return "${subQueryPropertyName}Parameter." + key;
}
#end
#end
#end
#end
#if (${col.isJavaNativeNumberObject()})
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#if (!${referrer.isOneToOne()})
#set ($relatedCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}")
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_SpecifyDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_SpecifyDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#end
#if (${col.isSingleKeyForeignKey()} && !${fk.hasFixedCondition()})
#set ($relatedCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${referrer.ReferrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeRelation_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeRelation_${referrer.ReferrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.isSingleKeyForeignKey()} && !${fk.hasFixedCondition()})
#set ($relatedCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${fk.foreignPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
#if (${referrer.isOneToOne()})
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${referrer.ReferrerPropertyNameInitCapAsOne}")
#else
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_NotInScopeRelation_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_NotInScopeRelation_${referrer.ReferrerPropertyNameInitCap}")
#end
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#if (${col.hasSingleKeyReferrer()})
#foreach ($referrer in $col.singleKeyReferrers)
#if (!${referrer.isOneToOne()})
#set ($relatedCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}")
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_QueryDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_QueryDerivedReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryKeepMapGeneric = "String, ${relatedCQClassName}")
protected Map<${subQueryKeepMapGeneric}> _${subQueryPropertyName}Map;
public Map<${subQueryKeepMapGeneric}> get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
protected Map _${subQueryPropertyName}ParameterMap;
public Map get${subQueryPropertyNameInitCap}Parameter() { return _${subQueryPropertyName}ParameterMap; }
public String keep${subQueryPropertyNameInitCap}Parameter(Object parameterValue) {
if (_${subQueryPropertyName}ParameterMap == null) { _${subQueryPropertyName}ParameterMap = newLinkedHashMap(); }
String key = "subQueryParameterKey" + (_${subQueryPropertyName}ParameterMap.size() + 1);
_${subQueryPropertyName}ParameterMap.put(key, parameterValue); return "${subQueryPropertyName}Parameter." + key;
}
#end
#end
#end
#end
/**
* Add order-by as ascend.
* @return this. (NotNull)
*/
public ${myClassName} addOrderBy_${tmpJavaName}_Asc() { regOBA("${col.name}"); return this; }
/**
* Add order-by as descend.
* @return this. (NotNull)
*/
public ${myClassName} addOrderBy_${tmpJavaName}_Desc() { regOBD("${col.name}"); return this; }
#end
// ===================================================================================
// Specified Derived OrderBy
// =========================
/**
* Add order-by for specified derived column as ascend.
*
* cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchaseDatetime();
* }
* }, aliasName);
* // order by [alias-name] asc
* cb.addSpecifiedDerivedOrderBy_Asc(aliasName);
*
* @param aliasName The alias name specified at (Specify)DerivedReferrer. (NotNull)
* @return this. (NotNull)
*/
public ${myClassName} addSpecifiedDerivedOrderBy_Asc(String aliasName)
{ registerSpecifiedDerivedOrderBy_Asc(aliasName); return this; }
/**
* Add order-by for specified derived column as descend.
*
* cb.specify().derivedPurchaseList().max(new SubQuery<PurchaseCB>() {
* public void query(PurchaseCB subCB) {
* subCB.specify().columnPurchaseDatetime();
* }
* }, aliasName);
* // order by [alias-name] desc
* cb.addSpecifiedDerivedOrderBy_Desc(aliasName);
*
* @param aliasName The alias name specified at (Specify)DerivedReferrer. (NotNull)
* @return this. (NotNull)
*/
public ${myClassName} addSpecifiedDerivedOrderBy_Desc(String aliasName)
{ registerSpecifiedDerivedOrderBy_Desc(aliasName); return this; }
// ===================================================================================
// Union Query
// ===========
protected void reflectRelationOnUnionQuery(ConditionQuery baseQueryAsSuper, ConditionQuery unionQueryAsSuper) {
#if ($table.hasForeignKeyOrReferrerAsOne())
${myConditionQueryClassName} baseQuery = (${myConditionQueryClassName})baseQueryAsSuper;
${myConditionQueryClassName} unionQuery = (${myConditionQueryClassName})unionQueryAsSuper;
#end
#foreach ($fk in $table.foreignKeys)
if (baseQuery.hasConditionQuery${fk.foreignPropertyNameInitCap}()) {
#if ($fk.hasDynamicFixedCondition())
unionQuery.xsetParameterMap${fk.foreignPropertyNameInitCap}(baseQuery.getParameterMap${fk.foreignPropertyNameInitCap}());
unionQuery.getConditionQuery${fk.foreignPropertyNameInitCap}().reflectRelationOnUnionQuery(baseQuery.getConditionQuery${fk.foreignPropertyNameInitCap}(), unionQuery.getConditionQuery${fk.foreignPropertyNameInitCap}());
#else
unionQuery.query${fk.foreignPropertyNameInitCap}().reflectRelationOnUnionQuery(baseQuery.query${fk.foreignPropertyNameInitCap}(), unionQuery.query${fk.foreignPropertyNameInitCap}());
#end
}
#end
#foreach ($referrer in $table.referrerAsOneList)
if (baseQuery.hasConditionQuery${referrer.referrerPropertyNameInitCapAsOne}()) {
unionQuery.query${referrer.referrerPropertyNameInitCapAsOne}().reflectRelationOnUnionQuery(baseQuery.query${referrer.referrerPropertyNameInitCapAsOne}(), unionQuery.query${referrer.referrerPropertyNameInitCapAsOne}());
}
#end
}
// ===================================================================================
// Foreign Query
// =============
#foreach ($fk in $table.foreignKeys)
#set ($foreignCQClassName = "${fk.foreignTableExtendedConditionQueryClassName}")
#set ($dynamicFixedConditionArgs = "")
#if ($fk.hasDynamicFixedCondition())
#set ($dynamicFixedConditionArgs = "${fk.dynamicFixedConditionArgs}")
#end
/**
* Get the condition-query for relation table.
* ${fk.foreignDispForJavaDoc}
#if ($fk.hasDynamicFixedCondition())
* ${fk.dynamicFixedConditionArgsJavaDocString}
#end
* @return The instance of condition-query. (NotNull)
*/
public ${foreignCQClassName} query${fk.foreignPropertyNameInitCap}(${dynamicFixedConditionArgs}) {
#if ($fk.hasDynamicFixedCondition())
Map parameterMap = getParameterMap${fk.foreignPropertyNameInitCap}();
${fk.dynamicFixedConditionParameterMapSetup}
#end
return getConditionQuery${fk.foreignPropertyNameInitCap}();
}
protected ${foreignCQClassName} _conditionQuery${fk.foreignPropertyNameInitCap};
public ${foreignCQClassName} getConditionQuery${fk.ForeignPropertyNameInitCap}() {
if (_conditionQuery${fk.foreignPropertyNameInitCap} == null) {
_conditionQuery${fk.foreignPropertyNameInitCap} = xcreateQuery${fk.foreignPropertyNameInitCap}();
xsetupOuterJoin${fk.foreignPropertyNameInitCap}();
}
return _conditionQuery${fk.foreignPropertyNameInitCap};
}
#if ($fk.hasDynamicFixedCondition())
protected Map _parameterMap${fk.foreignPropertyNameInitCap};
public Map getParameterMap${fk.foreignPropertyNameInitCap}() {
if (_parameterMap${fk.foreignPropertyNameInitCap} == null) {
_parameterMap${fk.foreignPropertyNameInitCap} = newLinkedHashMap();
}
return _parameterMap${fk.foreignPropertyNameInitCap};
}
public void xsetParameterMap${fk.foreignPropertyNameInitCap}(Map parameterMap) {
_parameterMap${fk.foreignPropertyNameInitCap} = parameterMap; // for UnionQuery
}
#end
protected ${foreignCQClassName} xcreateQuery${fk.foreignPropertyNameInitCap}() {
String nrp = resolveNextRelationPath("${table.name}", "${fk.foreignPropertyName}");
String jan = resolveJoinAliasName(nrp, xgetNextNestLevel());
${foreignCQClassName} cq = new ${foreignCQClassName}(this, xgetSqlClause(), jan, xgetNextNestLevel());
cq.xsetForeignPropertyName("${fk.foreignPropertyName}");
cq.xsetRelationPath(nrp); return cq;
}
protected void xsetupOuterJoin${fk.foreignPropertyNameInitCap}() {
${foreignCQClassName} cq = getConditionQuery${fk.foreignPropertyNameInitCap}();
Map joinOnMap = newLinkedHashMap();
#foreach ($columnName in $fk.LocalColumns)
#set ($localColumn = $table.getColumn($columnName))
#set ($foreignColumnName = $fk.getLocalForeignMapping().get($columnName))
joinOnMap.put("${localColumn.name}", "${foreignColumnName}");
#end
#if ($fk.hasFixedCondition())
registerOuterJoin(cq, joinOnMap, "${fk.fixedCondition}");
#else
registerOuterJoin(cq, joinOnMap);
#end
}
public boolean hasConditionQuery${fk.ForeignPropertyNameInitCap}() {
return _conditionQuery${fk.ForeignPropertyNameInitCap} != null;
}
#end
#foreach ($referrer in $table.referrerAsOneList)
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
/**
* Get the condition-query for relation table.
* ${referrer.referrerDispAsOneForJavaDoc}
* @return The instance of condition-query. (NotNull)
*/
public ${relatedCQClassName} query${referrer.referrerPropertyNameInitCapAsOne}() {
return getConditionQuery${referrer.referrerPropertyNameInitCapAsOne}();
}
protected ${relatedCQClassName} _conditionQuery${referrer.referrerPropertyNameInitCapAsOne};
public ${relatedCQClassName} getConditionQuery${referrer.referrerPropertyNameInitCapAsOne}() {
if (_conditionQuery${referrer.referrerPropertyNameInitCapAsOne} == null) {
_conditionQuery${referrer.referrerPropertyNameInitCapAsOne} = xcreateQuery${referrer.referrerPropertyNameInitCapAsOne}();
xsetupOuterJoin${referrer.referrerPropertyNameInitCapAsOne}();
}
return _conditionQuery${referrer.referrerPropertyNameInitCapAsOne};
}
protected ${relatedCQClassName} xcreateQuery${referrer.referrerPropertyNameInitCapAsOne}() {
String nrp = resolveNextRelationPath("${table.name}", "${referrer.referrerPropertyNameAsOne}");
String jan = resolveJoinAliasName(nrp, xgetNextNestLevel());
${relatedCQClassName} cq = new ${relatedCQClassName}(this, xgetSqlClause(), jan, xgetNextNestLevel());
cq.xsetForeignPropertyName("${referrer.referrerPropertyNameAsOne}");
cq.xsetRelationPath(nrp); return cq;
}
protected void xsetupOuterJoin${referrer.referrerPropertyNameInitCapAsOne}() {
${relatedCQClassName} cq = getConditionQuery${referrer.referrerPropertyNameInitCapAsOne}();
Map joinOnMap = newLinkedHashMap();
#foreach ($columnName in $referrer.foreignColumns)
#set ($foreignColumn = $table.getColumn($columnName))
#set ($referrerColumnName = $referrer.getForeignLocalMapping().get($columnName))
joinOnMap.put("${foreignColumn.name}", "${referrerColumnName}");
#end
#if ($referrer.hasFixedCondition())
registerOuterJoin(cq, joinOnMap, "${referrer.fixedCondition}");
#else
registerOuterJoin(cq, joinOnMap);
#end
}
public boolean hasConditionQuery${referrer.referrerPropertyNameInitCapAsOne}() {
return _conditionQuery${referrer.referrerPropertyNameInitCapAsOne} != null;
}
#end
#if ($table.hasSinglePrimaryKey())
// ===================================================================================
// Scalar SubQuery
// ===============
protected Map _scalarConditionMap;
public Map getScalarCondition() { return _scalarConditionMap; }
public String keepScalarCondition(${myConditionQueryClassName} subQuery) {
if (_scalarConditionMap == null) { _scalarConditionMap = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_scalarConditionMap.size() + 1);
_scalarConditionMap.put(key, subQuery); return "scalarCondition." + key;
}
// ===================================================================================
// MySelf InScope SubQuery
// =======================
protected Map _myselfInScopeRelationMap;
public Map getMyselfInScopeRelation() { return _myselfInScopeRelationMap; }
public String keepMyselfInScopeRelation(${myConditionQueryClassName} subQuery) {
if (_myselfInScopeRelationMap == null) { _myselfInScopeRelationMap = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_myselfInScopeRelationMap.size() + 1);
_myselfInScopeRelationMap.put(key, subQuery); return "myselfInScopeRelation." + key;
}
#end
#if (${table.hasTwoOrMoreKeyReferrer()})
// ===================================================================================
// Two-or-More PK's Exists Referrer
// ================================
#foreach ($referrer in $table.referrerList)
#if (${referrer.isTwoOrMoreKeyFK()})
#set ($tmpJavaName = "TwoOrMorePk")
#set ($tmpUncapitalisedJavaName = "twoOrMorePk")
#set ($relatedCBClassName = "${referrer.referrerTableExtendedConditionBeanClassName}")
#set ($relatedCQClassName = "${referrer.referrerTableExtendedConditionQueryClassName}")
#if (${referrer.isOneToOne()})
#set ($relationPropertyNameInitCap = "${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCapAsOne}")
#else
#set ($relationPropertyNameInitCap = "${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsReferrer_${referrer.referrerPropertyNameInitCap}")
#end
/**
* Set up 'exists-referrer' (co-related sub-query).
* {exists (select ... from ${referrer.table.name} where ...)}
* @param subQuery The sub-query of ${relationPropertyNameInitCap} for 'exists'. (NotNull)
*/
public void exists${relationPropertyNameInitCap}(SubQuery<${relatedCBClassName}> subQuery) {
assertObjectNotNull("subQuery<${relatedCBClassName}>", subQuery);
${relatedCBClassName} cb = new ${relatedCBClassName}(); cb.xsetupForExistsReferrer(this); subQuery.query(cb);
String subQueryPropertyName = keep${subQueryPropertyNameInitCap}(cb.query()); // for saving query-value.
registerExistsReferrer(cb.query(), "${referrer.foreignColumnNames}", "${referrer.localColumnNames}", subQueryPropertyName);
}
protected Map _${subQueryPropertyName}Map;
public Map get${subQueryPropertyNameInitCap}() { return _${subQueryPropertyName}Map; }
public String keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
if (_${subQueryPropertyName}Map == null) { _${subQueryPropertyName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_${subQueryPropertyName}Map.size() + 1);
_${subQueryPropertyName}Map.put(key, subQuery); return "${subQueryPropertyName}." + key;
}
#end
#end
#end
#if ($table.isBuriTarget() && $database.hasBuriAllRoundStateHistory())
// ===================================================================================
// Buri Interface
// ==============
#set ($relatedCBClassName = "${glProjectPrefix}BuriAllRoundStateHistoryCB")
#set ($relatedCQClassName = "${glProjectPrefix}BuriAllRoundStateHistoryCQ")
#foreach ($processName in $table.tableProcessForMethodNameList)
public void existsBuriAllRoundStateHistory_${processName}(SubQuery<${relatedCBClassName}> subQuery) {
assertObjectNotNull("subQuery<${relatedCBClassName}>", subQuery);
${relatedCBClassName} cb = new ${relatedCBClassName}(); cb.xsetupForExistsReferrer(this);
cb.query().setInternalDataType_Equal("${glPackageExtendedEntity}.${myExtendedObjectClassName}"); subQuery.query(cb);
String subQueryPropertyName = keepBuriAllRoundStateHistory_${processName}(cb.query()); // for saving query-value.
registerExistsReferrer(cb.query(), "${table.primaryKeyNameAsOne}", "INTERNAL_PK_VALUE", subQueryPropertyName);
}
protected Map _buriAllRoundStateHistory_${processName}Map;
public Map getBuriAllRoundStateHistory${processName}() { return _buriAllRoundStateHistory_${processName}Map; }
public String keepBuriAllRoundStateHistory_${processName}(${relatedCQClassName} subQuery) {
if (_buriAllRoundStateHistory_${processName}Map == null) { _buriAllRoundStateHistory_${processName}Map = newLinkedHashMap(); }
String key = "subQueryMapKey" + (_buriAllRoundStateHistory_${processName}Map.size() + 1);
_buriAllRoundStateHistory_${processName}Map.put(key, subQuery); return "buriAllRoundStateHistory${processName}." + key;
}
#end
#end
#if ($table.isBuriAllRoundStateHistory())
// ===================================================================================
// Buri Interface
// ==============
public void setStatus_Equal(${glPackagePluginBuri}.${glBuriDef}.BuriStatus status) {
if (status == null) { return; }
setStatusPathName_Equal(status.path());
}
public void setStatus_InScope(java.util.List<${glPackagePluginBuri}.${glBuriDef}.BuriStatus> statusList) {
if (statusList == null || statusList.isEmpty()) { return; }
java.util.List statusPathList = new java.util.ArrayList();
for (${glPackagePluginBuri}.${glBuriDef}.BuriStatus status : statusList) {
statusPathList.add(status.path());
}
setStatusPathName_InScope(statusPathList);
}
#end
// ===================================================================================
// Very Internal
// =============
// very internal (for suppressing warn about 'Not Use Import')
protected String xCB() { return ${myConditionBeanClassName}.class.getName(); }
protected String xCQ() { return ${myConditionQueryClassName}.class.getName(); }
protected String xMap() { return Map.class.getName(); }
}