Search in sources :

Example 11 with TnPropertyType

use of org.dbflute.s2dao.metadata.TnPropertyType in project dbflute-core by dbflute.

the class AbstractBatchUpdateCommand method createNonOrderedPropertyNames.

private String[] createNonOrderedPropertyNames(TnBeanMetaData bmd) {
    final List<String> propertyNameList = new ArrayList<String>();
    final List<TnPropertyType> ptList = bmd.getPropertyTypeList();
    for (TnPropertyType pt : ptList) {
        if (pt.isPersistent()) {
            propertyNameList.add(pt.getPropertyName());
        }
    }
    return propertyNameList.toArray(new String[propertyNameList.size()]);
}
Also used : ArrayList(java.util.ArrayList) TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Example 12 with TnPropertyType

use of org.dbflute.s2dao.metadata.TnPropertyType in project dbflute-core by dbflute.

the class TnRelationRowCreatorExtension method setupPropertyCache.

// ===================================================================================
// Property Cache Setup
// ====================
@Override
protected void setupPropertyCache(TnRelationRowCreationResource res) throws SQLException {
    // - - - - - - - - - - -
    if (res.isStopCurrentRelationMapping()) {
        return;
    }
    // set up property cache about current bean meta data
    final TnBeanMetaData nextBmd = res.getRelationBeanMetaData();
    final List<TnPropertyType> ptList = nextBmd.getPropertyTypeList();
    for (TnPropertyType pt : ptList) {
        // already been filtered as target only
        res.setCurrentPropertyType(pt);
        setupPropertyCacheElement(res);
    }
    // set up next level relation's property cache
    if (res.isStopNextRelationMapping()) {
        return;
    }
    res.prepareNextLevelMapping();
    try {
        setupNextPropertyCache(res, nextBmd);
    } finally {
        res.closeNextLevelMapping();
    }
}
Also used : TnBeanMetaData(org.dbflute.s2dao.metadata.TnBeanMetaData) TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Example 13 with TnPropertyType

use of org.dbflute.s2dao.metadata.TnPropertyType in project dbflute-core by dbflute.

the class TnBeanMetaDataImpl method setupPrimaryKey.

protected void setupPrimaryKey() {
    // only called in the initialize() process
    final List<TnPropertyType> keys = new ArrayList<TnPropertyType>();
    for (TnPropertyType pt : _propertyTypeList) {
        if (pt.isPrimaryKey()) {
            keys.add(pt);
            setupIdentifierGenerator(pt);
        }
    }
    _primaryKeys = (TnPropertyType[]) keys.toArray(new TnPropertyType[keys.size()]);
}
Also used : ArrayList(java.util.ArrayList) TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Example 14 with TnPropertyType

use of org.dbflute.s2dao.metadata.TnPropertyType in project dbflute-core by dbflute.

the class TnBeanMetaDataImpl method getPropertyType.

public TnPropertyType getPropertyType(String propertyName) {
    final TnPropertyType propertyType = (TnPropertyType) _propertyTypeMap.get(propertyName);
    if (propertyType == null) {
        String msg = "The propertyName was not found in the map:";
        msg = msg + " propertyName=" + propertyName + " propertyTypeMap=" + _propertyTypeMap;
        throw new IllegalStateException(msg);
    }
    return propertyType;
}
Also used : TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Example 15 with TnPropertyType

use of org.dbflute.s2dao.metadata.TnPropertyType in project dbflute-core by dbflute.

the class TnBeanMetaDataImpl method throwBeanMetaPropertyTypeByColumnNameNotFoundException.

protected void throwBeanMetaPropertyTypeByColumnNameNotFoundException(String columnName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The column was not found in the table.");
    br.addItem("Bean Class");
    br.addElement(_beanClass);
    br.addItem("Column");
    br.addElement(_tableName + "." + columnName);
    br.addItem("DBMeta");
    br.addElement(_dbmeta);
    br.addItem("Mapping");
    final Set<Entry<String, TnPropertyType>> entrySet = _columnPropertyTypeMap.entrySet();
    for (Entry<String, TnPropertyType> entry : entrySet) {
        br.addElement(entry.getKey() + ": " + entry.getValue());
    }
    final String msg = br.buildExceptionMessage();
    throw new IllegalStateException(msg);
}
Also used : Entry(java.util.Map.Entry) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Aggregations

TnPropertyType (org.dbflute.s2dao.metadata.TnPropertyType)25 ArrayList (java.util.ArrayList)12 TnBeanMetaData (org.dbflute.s2dao.metadata.TnBeanMetaData)7 ConditionBean (org.dbflute.cbean.ConditionBean)3 DBMeta (org.dbflute.dbmeta.DBMeta)3 ColumnSqlName (org.dbflute.dbmeta.name.ColumnSqlName)3 ValueType (org.dbflute.jdbc.ValueType)3 Timestamp (java.sql.Timestamp)2 Entity (org.dbflute.Entity)2 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)2 DfPropertyDesc (org.dbflute.helper.beans.DfPropertyDesc)2 TnIdentifierGenerator (org.dbflute.s2dao.identity.TnIdentifierGenerator)2 TnCommandContextHandler (org.dbflute.s2dao.sqlhandler.TnCommandContextHandler)2 CommandContext (org.dbflute.twowaysql.context.CommandContext)2 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 SqlClause (org.dbflute.cbean.sqlclause.SqlClause)1