use of org.dbflute.dbmeta.info.ForeignInfo in project dbflute-core by dbflute.
the class AbstractSqlClause method createSelectedSelectColumnInfo.
protected Map<String, SelectedRelationColumn> createSelectedSelectColumnInfo(String foreignTableAliasName, String localTableDbName, String foreignPropertyName, String localRelationPath) {
final DBMeta dbmeta = findDBMeta(localTableDbName);
final ForeignInfo foreignInfo = dbmeta.findForeignInfo(foreignPropertyName);
final int relationNo = foreignInfo.getRelationNo();
String nextRelationPath = RELATION_PATH_DELIMITER + relationNo;
if (localRelationPath != null) {
nextRelationPath = localRelationPath + nextRelationPath;
}
final Map<String, SelectedRelationColumn> resultMap = new LinkedHashMap<String, SelectedRelationColumn>();
final DBMeta foreignDBMeta = foreignInfo.getForeignDBMeta();
final List<ColumnInfo> columnInfoList = foreignDBMeta.getColumnInfoList();
for (ColumnInfo columnInfo : columnInfoList) {
final String columnDbName = columnInfo.getColumnDbName();
final SelectedRelationColumn selectColumnInfo = new SelectedRelationColumn();
selectColumnInfo.setTableAliasName(foreignTableAliasName);
selectColumnInfo.setColumnInfo(columnInfo);
selectColumnInfo.setRelationNoSuffix(nextRelationPath);
resultMap.put(columnDbName, selectColumnInfo);
}
return resultMap;
}
use of org.dbflute.dbmeta.info.ForeignInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method cfi.
protected // relation name
ForeignInfo cfi(// relation name
String constraintName, // relation name
String foreignPropertyName, // DB meta
DBMeta localDbm, // DB meta
DBMeta foreignDbm, // relation attribute
Map<ColumnInfo, ColumnInfo> localForeignColumnInfoMap, // relation attribute
int relationNo, // relation attribute
Class<?> propertyAccessType, // relation type
boolean oneToOne, // relation type
boolean bizOneToOne, // relation type
boolean referrerAsOne, // relation type
boolean additionalFK, // fixed condition
String fixedCondition, // fixed condition
List<String> dynamicParameterList, // fixed condition
boolean fixedInline, // various info
String reversePropertyName, // various info
boolean canBeNullObject) {
// createForeignInfo()
final Class<?> realPt = chooseForeignPropertyAccessType(foreignDbm, propertyAccessType);
final PropertyMethodFinder propertyMethodFinder = createForeignPropertyMethodFinder();
return new ForeignInfo(constraintName, foreignPropertyName, localDbm, foreignDbm, localForeignColumnInfoMap, relationNo, realPt, oneToOne, bizOneToOne, referrerAsOne, additionalFK, fixedCondition, dynamicParameterList, fixedInline, reversePropertyName, canBeNullObject, propertyMethodFinder);
}
use of org.dbflute.dbmeta.info.ForeignInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method getForeignInfoRelationNoKeyMap.
/**
* Get the relation-no key map of foreign information.
* @return The unordered map of foreign information. (NotNull, EmptyAllowed, ReadOnly)
*/
protected Map<Integer, ForeignInfo> getForeignInfoRelationNoKeyMap() {
if (_foreignInfoRelationNoKeyMap != null) {
return _foreignInfoRelationNoKeyMap;
}
final List<ForeignInfo> foreignInfoList = getForeignInfoList();
synchronized (this) {
if (_foreignInfoRelationNoKeyMap != null) {
return _foreignInfoRelationNoKeyMap;
}
final Map<Integer, ForeignInfo> map = newConcurrentHashMap();
for (ForeignInfo foreignInfo : foreignInfoList) {
map.put(foreignInfo.getRelationNo(), foreignInfo);
}
_foreignInfoRelationNoKeyMap = Collections.unmodifiableMap(map);
return _foreignInfoRelationNoKeyMap;
}
}
use of org.dbflute.dbmeta.info.ForeignInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method getForeignInfoList.
/**
* {@inheritDoc}
*/
public List<ForeignInfo> getForeignInfoList() {
if (_foreignInfoList != null) {
return _foreignInfoList;
}
synchronized (this) {
if (_foreignInfoList != null) {
return _foreignInfoList;
}
final Method[] methods = this.getClass().getMethods();
final List<ForeignInfo> workingList = newArrayList();
final String prefix = "foreign";
final Class<ForeignInfo> returnType = ForeignInfo.class;
for (Method method : methods) {
if (method.getName().startsWith(prefix) && returnType.equals(method.getReturnType())) {
workingList.add((ForeignInfo) DfReflectionUtil.invoke(method, this, null));
}
}
_foreignInfoList = Collections.unmodifiableList(workingList);
return _foreignInfoList;
}
}
use of org.dbflute.dbmeta.info.ForeignInfo in project dbflute-core by dbflute.
the class AbstractDBMeta method getForeignInfoFlexibleMap.
/**
* Get the flexible map of foreign information.
* @return The flexible map of foreign information. (NotNull, EmptyAllowed, ReadOnly)
*/
protected Map<String, ForeignInfo> getForeignInfoFlexibleMap() {
if (_foreignInfoFlexibleMap != null) {
return _foreignInfoFlexibleMap;
}
final List<ForeignInfo> foreignInfoList = getForeignInfoList();
synchronized (this) {
if (_foreignInfoFlexibleMap != null) {
return _foreignInfoFlexibleMap;
}
final StringKeyMap<ForeignInfo> map = createFlexibleConcurrentMap();
for (ForeignInfo foreignInfo : foreignInfoList) {
map.put(foreignInfo.getForeignPropertyName(), foreignInfo);
}
_foreignInfoFlexibleMap = Collections.unmodifiableMap(map);
return _foreignInfoFlexibleMap;
}
}
Aggregations