use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method cri.
protected // relation name
ReferrerInfo cri(// relation name
String constraintName, // relation name
String referrerPropertyName, // DB meta
DBMeta localDbm, // DB meta
DBMeta referrerDbm, // relation attribute
Map<ColumnInfo, ColumnInfo> localReferrerColumnInfoMap, // relation type and various info
boolean oneToOne, // relation type and various info
String reversePropertyName) {
// createReferrerInfo()
final Class<?> propertyAccessType = chooseReferrerPropertyAccessType(referrerDbm, oneToOne);
final PropertyMethodFinder propertyMethodFinder = createReferrerPropertyMethodFinder();
return new ReferrerInfo(constraintName, referrerPropertyName, localDbm, referrerDbm, localReferrerColumnInfoMap, propertyAccessType, oneToOne, reversePropertyName, propertyMethodFinder);
}
use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.
the class AbstractBehaviorReadable method doHelpLoadReferrerInternally.
protected <// generic
LOCAL_ENTITY extends Entity, // generic
KEY, // generic
REFERRER_CB extends ConditionBean, // generic
REFERRER_ENTITY extends Entity> NestedReferrerListGateway<REFERRER_ENTITY> doHelpLoadReferrerInternally(List<LOCAL_ENTITY> localEntityList, LoadReferrerOption<REFERRER_CB, REFERRER_ENTITY> loadReferrerOption, final String referrerProperty) {
final DBMeta dbmeta = asDBMeta();
final ReferrerInfo referrerInfo = dbmeta.findReferrerInfo(referrerProperty);
final BehaviorReadable referrerBhv = xfindReferrerBehavior(referrerInfo);
// might be unique key
final Set<ColumnInfo> pkColSet = referrerInfo.getLocalReferrerColumnInfoMap().keySet();
// key is referrer's
final Map<ColumnInfo, ColumnInfo> mappingColMap = referrerInfo.getReferrerLocalColumnInfoMap();
final InternalLoadReferrerCallback<LOCAL_ENTITY, KEY, REFERRER_CB, REFERRER_ENTITY> callback;
if (pkColSet.size() == 1) {
// simple key
final ColumnInfo pkCol = pkColSet.iterator().next();
final ColumnInfo fkCol = mappingColMap.keySet().iterator().next();
callback = xcreateLoadReferrerCallback(referrerProperty, dbmeta, referrerInfo, referrerBhv, pkCol, fkCol);
} else {
// compound key
final Set<ColumnInfo> fkColSet = mappingColMap.keySet();
callback = xcreateLoadReferrerCallback(referrerProperty, dbmeta, referrerInfo, referrerBhv, pkColSet, fkColSet, mappingColMap);
}
return helpLoadReferrerInternally(localEntityList, loadReferrerOption, callback);
}
use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method xbuildReferrerCorrelatedFixedCondition.
protected String xbuildReferrerCorrelatedFixedCondition(ConditionQuery subQuery, String referrerPropertyName) {
if (referrerPropertyName == null) {
return null;
}
final DBMeta localDBMeta = xgetLocalDBMeta();
if (!localDBMeta.hasReferrer(referrerPropertyName)) {
// one-to-one referrer
return null;
}
final ReferrerInfo referrerInfo = localDBMeta.findReferrerInfo(referrerPropertyName);
return xdoBuildReferrerCorrelatedFixedCondition(subQuery, referrerInfo);
}
use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.
the class AbstractConditionQuery method xbuildForeignCorrelatedFixedCondition.
protected String xbuildForeignCorrelatedFixedCondition(ConditionQuery subQuery, String relationPropertyName) {
if (relationPropertyName == null) {
return null;
}
final DBMeta localDBMeta = xgetLocalDBMeta();
final RelationInfo relationInfo = localDBMeta.findRelationInfo(relationPropertyName);
if (!relationInfo.isReferrer()) {
return null;
}
if (!(relationInfo instanceof ReferrerInfo)) {
return null;
}
final ReferrerInfo referrerInfo = (ReferrerInfo) relationInfo;
return xdoBuildReferrerCorrelatedFixedCondition(subQuery, referrerInfo);
}
use of org.dbflute.dbmeta.info.ReferrerInfo in project dbflute-core by dbflute.
the class AbstractBehaviorReadable method xbuildReferrerCorrelatedFixedCondition.
protected String xbuildReferrerCorrelatedFixedCondition(ConditionBean cb, String referrerPropertyName) {
if (referrerPropertyName == null) {
return null;
}
final DBMeta localDBMeta = asDBMeta();
if (!localDBMeta.hasReferrer(referrerPropertyName)) {
// one-to-one referrer
return null;
}
final ReferrerInfo referrerInfo = localDBMeta.findReferrerInfo(referrerPropertyName);
return xdoBuildReferrerCorrelatedFixedCondition(cb, referrerInfo);
}
Aggregations