Search in sources :

Example 6 with LeftOuterJoinInfo

use of org.dbflute.cbean.sqlclause.join.LeftOuterJoinInfo in project dbflute-core by dbflute.

the class AbstractSqlClause method getLeftOuterJoinClause.

// ===================================================================================
// Join Clause
// ===========
// Clause Parts
protected String getLeftOuterJoinClause() {
    final StringBuilder sb = new StringBuilder();
    checkFixedConditionLazily();
    reflectInnerJoinAutoDetectLazily();
    final boolean countLeastJoinAllowed = checkCountLeastJoinAllowed();
    final boolean structuralPossibleInnerJoinAllowed = checkStructuralPossibleInnerJoinAllowed();
    for (Entry<String, LeftOuterJoinInfo> outerJoinEntry : getOuterJoinMap().entrySet()) {
        final String foreignAliasName = outerJoinEntry.getKey();
        final LeftOuterJoinInfo joinInfo = outerJoinEntry.getValue();
        if (countLeastJoinAllowed && canBeCountLeastJoin(joinInfo)) {
            // means only joined countable
            continue;
        }
        buildLeftOuterJoinClause(sb, foreignAliasName, joinInfo, structuralPossibleInnerJoinAllowed);
    }
    return sb.toString();
}
Also used : LeftOuterJoinInfo(org.dbflute.cbean.sqlclause.join.LeftOuterJoinInfo)

Example 7 with LeftOuterJoinInfo

use of org.dbflute.cbean.sqlclause.join.LeftOuterJoinInfo in project dbflute-core by dbflute.

the class AbstractSqlClause method isUnderOverRelation.

/**
 * {@inheritDoc}
 */
public boolean isUnderOverRelation(String relationPath) {
    final Map<String, String> relationPathForeignAliasMap = getRelationPathForeignAliasMap();
    final String foreignAliasName = relationPathForeignAliasMap.get(relationPath);
    if (foreignAliasName == null) {
        // basically no way
        String msg = "Not found the foreign alias name by the relation path:";
        msg = msg + " " + relationPath + ", " + relationPathForeignAliasMap.keySet();
        throw new IllegalStateException(msg);
    }
    final Map<String, LeftOuterJoinInfo> outerJoinMap = getOuterJoinMap();
    final LeftOuterJoinInfo outerJoinInfo = outerJoinMap.get(foreignAliasName);
    if (outerJoinInfo == null) {
        // basically no way
        String msg = "Not found the outer join info by the foreign alias name:";
        msg = msg + " " + relationPath + ", " + foreignAliasName + ", " + outerJoinMap.keySet();
        throw new IllegalStateException(msg);
    }
    return outerJoinInfo.isUnderOverRelation();
}
Also used : LeftOuterJoinInfo(org.dbflute.cbean.sqlclause.join.LeftOuterJoinInfo)

Aggregations

LeftOuterJoinInfo (org.dbflute.cbean.sqlclause.join.LeftOuterJoinInfo)7 OrScopeQueryAndPartQueryClause (org.dbflute.cbean.sqlclause.query.OrScopeQueryAndPartQueryClause)1 QueryClause (org.dbflute.cbean.sqlclause.query.QueryClause)1 StringQueryClause (org.dbflute.cbean.sqlclause.query.StringQueryClause)1