use of org.dbflute.s2dao.metadata.TnRelationPropertyType in project dbflute-core by dbflute.
the class TnBeanMetaDataImpl method getPropertyTypeByAliasName.
public TnPropertyType getPropertyTypeByAliasName(String alias) {
if (hasPropertyTypeByColumnName(alias)) {
return getPropertyTypeByColumnName(alias);
}
final int index = alias.lastIndexOf('_');
if (index < 0) {
String msg = "The alias was not found in the table: table=" + _tableName + " alias=" + alias;
throw new IllegalStateException(msg);
}
final String columnName = alias.substring(0, index);
final String relnoStr = alias.substring(index + 1);
int relno = -1;
try {
relno = Integer.parseInt(relnoStr);
} catch (Throwable t) {
String msg = "The alias was not found in the table: table=" + _tableName + " alias=" + alias;
throw new IllegalStateException(msg, t);
}
final TnRelationPropertyType rpt = getRelationPropertyType(relno);
if (!rpt.getYourBeanMetaData().hasPropertyTypeByColumnName(columnName)) {
String msg = "The alias was not found in the table: table=" + _tableName + " alias=" + alias;
throw new IllegalStateException(msg);
}
return rpt.getYourBeanMetaData().getPropertyTypeByColumnName(columnName);
}
use of org.dbflute.s2dao.metadata.TnRelationPropertyType in project dbflute-core by dbflute.
the class TnBeanMetaDataImpl method setupProperty.
protected void setupProperty() {
// only called in the initialize() process
final TnPropertyType[] propertyTypes = _propertyTypeFactory.createBeanPropertyTypes();
for (int i = 0; i < propertyTypes.length; i++) {
TnPropertyType pt = propertyTypes[i];
addPropertyType(pt);
_columnPropertyTypeMap.put(pt.getColumnDbName(), pt);
}
final TnRelationPropertyType[] rptTypes = _relationPropertyTypeFactory.createRelationPropertyTypes();
for (int i = 0; i < rptTypes.length; i++) {
TnRelationPropertyType rpt = rptTypes[i];
addRelationPropertyType(rpt);
}
}
use of org.dbflute.s2dao.metadata.TnRelationPropertyType in project dbflute-core by dbflute.
the class TnBeanMetaDataImpl method hasPropertyTypeByAliasName.
public boolean hasPropertyTypeByAliasName(String alias) {
if (hasPropertyTypeByColumnName(alias)) {
return true;
}
final int index = alias.lastIndexOf('_');
if (index < 0) {
return false;
}
final String columnName = alias.substring(0, index);
final String relnoStr = alias.substring(index + 1);
int relno = -1;
try {
relno = Integer.parseInt(relnoStr);
} catch (Throwable t) {
return false;
}
if (relno >= getRelationPropertyTypeSize()) {
return false;
}
final TnRelationPropertyType rpt = getRelationPropertyType(relno);
return rpt.getYourBeanMetaData().hasPropertyTypeByColumnName(columnName);
}
use of org.dbflute.s2dao.metadata.TnRelationPropertyType in project dbflute-core by dbflute.
the class TnRelationPropertyTypeFactoryImpl method createRelationPropertyTypes.
// ===================================================================================
// Create Relation
// ===============
public TnRelationPropertyType[] createRelationPropertyTypes() {
final List<TnRelationPropertyType> relList = new ArrayList<TnRelationPropertyType>(RELATION_SIZE_CAPACITY);
final DfBeanDesc localBeanDesc = getLocalBeanDesc();
final List<String> proppertyNameList = localBeanDesc.getProppertyNameList();
for (String proppertyName : proppertyNameList) {
final DfPropertyDesc propertyDesc = localBeanDesc.getPropertyDesc(proppertyName);
if (_stopRelationCreation || !isRelationProperty(propertyDesc)) {
continue;
}
relList.add(createRelationPropertyType(propertyDesc));
}
return relList.toArray(new TnRelationPropertyType[relList.size()]);
}
use of org.dbflute.s2dao.metadata.TnRelationPropertyType in project dbflute-core by dbflute.
the class TnRelationRowCreatorImpl method createPropertyCache.
// ===================================================================================
// Property Cache Creation
// =======================
/**
* {@inheritDoc}
*/
public Map<String, Map<String, TnPropertyMapping>> createPropertyCache(Map<String, String> selectColumnMap, Map<String, Map<String, Integer>> selectIndexMap, TnRelationSelector relSelector, TnBeanMetaData baseBmd) throws SQLException {
// - - - - - - -
// Entry Point!
// - - - - - - -
final Map<String, Map<String, TnPropertyMapping>> relPropCache = newRelationPropertyCache();
final List<TnRelationPropertyType> relationPropertyTypeList = baseBmd.getRelationPropertyTypeList();
for (TnRelationPropertyType rpt : relationPropertyTypeList) {
final String baseSuffix = "";
final String relationNoSuffix = rpt.getRelationNoSuffixPart();
final TnRelationRowCreationResource res = createResourceForPropertyCache(rpt, selectColumnMap, selectIndexMap, relPropCache, relSelector, baseSuffix, relationNoSuffix, getLimitRelationNestLevel());
setupPropertyCache(res);
}
return relPropCache;
}
Aggregations