Search in sources :

Example 6 with RelationInfo

use of org.dbflute.dbmeta.info.RelationInfo in project dbflute-core by dbflute.

the class AbstractConditionQuery method xdoBuildReferrerCorrelatedFixedCondition.

protected String xdoBuildReferrerCorrelatedFixedCondition(ConditionQuery subQuery, ReferrerInfo referrerInfo) {
    final RelationInfo reverseRelation = referrerInfo.getReverseRelation();
    if (reverseRelation == null) {
        return null;
    }
    if (!(reverseRelation instanceof ForeignInfo)) {
        String msg = "The reverse relation (referrer's reverse) should be foreign info: " + referrerInfo;
        throw new IllegalStateException(msg);
    }
    final ForeignInfo foreignInfo = (ForeignInfo) reverseRelation;
    final String fixedCondition = foreignInfo.getFixedCondition();
    if (fixedCondition == null || fixedCondition.trim().length() == 0) {
        return null;
    }
    final FixedConditionResolver resolver = createReferrerFixedConditionResolver(subQuery);
    return resolver.resolveVariable(fixedCondition, false);
}
Also used : ForeignInfo(org.dbflute.dbmeta.info.ForeignInfo) FixedConditionResolver(org.dbflute.cbean.sqlclause.join.FixedConditionResolver) RelationInfo(org.dbflute.dbmeta.info.RelationInfo)

Aggregations

RelationInfo (org.dbflute.dbmeta.info.RelationInfo)6 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ForeignInfo (org.dbflute.dbmeta.info.ForeignInfo)3 Collection (java.util.Collection)2 LinkedHashMap (java.util.LinkedHashMap)2 DBMeta (org.dbflute.dbmeta.DBMeta)2 Map (java.util.Map)1 ConditionBean (org.dbflute.cbean.ConditionBean)1 AndQuery (org.dbflute.cbean.scoping.AndQuery)1 FixedConditionResolver (org.dbflute.cbean.sqlclause.join.FixedConditionResolver)1 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)1 ReferrerInfo (org.dbflute.dbmeta.info.ReferrerInfo)1 RelationOptionalFactory (org.dbflute.optional.RelationOptionalFactory)1