use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class HpDerivingSubQueryInfo method extractDerivingColumnInfo.
public ColumnInfo extractDerivingColumnInfo() {
final SqlClause subQuerySqlClause = _derivedReferrer.getSubQuerySqlClause();
final ColumnInfo columnInfo = subQuerySqlClause.getSpecifiedColumnInfoAsOne();
if (columnInfo != null) {
return columnInfo;
}
// nested
return subQuerySqlClause.getSpecifiedDerivingColumnInfoAsOne();
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class ConditionKey method doResolveCompoundColumnCipher.
protected ColumnRealName doResolveCompoundColumnCipher(ConditionOption option, SpecifiedColumn specifiedColumn) {
final GearedCipherManager cipherManager = option.getGearedCipherManager();
final ColumnRealName specifiedName = specifiedColumn.toColumnRealName();
if (cipherManager != null && !specifiedColumn.isDerived()) {
final ColumnInfo columnInfo = specifiedColumn.getColumnInfo();
final ColumnFunctionCipher cipher = cipherManager.findColumnFunctionCipher(columnInfo);
if (cipher != null) {
return toColumnRealName(cipher.decrypt(specifiedName.toString()));
} else {
return specifiedName;
}
} else {
return specifiedName;
}
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method helpReloadPrimaryKeyIfUniqueByIfNeeds.
protected <RESULT extends ENTITY> void helpReloadPrimaryKeyIfUniqueByIfNeeds(RESULT entity, UpdateOption<CB> option) {
if (option == null || !option.isReloadPrimaryKeyIfUniqueBy()) {
return;
}
final Set<String> uniqueProp = entity.myuniqueDrivenProperties();
if (uniqueProp.isEmpty()) {
// updated by PK normally
return;
}
final DBMeta dbmeta = entity.asDBMeta();
if (!dbmeta.hasPrimaryKey()) {
// no PK table but has unique key
return;
}
final CB cb = newConditionBean();
final List<ColumnInfo> pkList = dbmeta.getPrimaryInfo().getPrimaryColumnList();
for (ColumnInfo pk : pkList) {
cb.invokeSpecifyColumn(pk.getPropertyName());
}
for (String uq : uniqueProp) {
cb.localCQ().invokeQueryEqual(uq, dbmeta.findColumnInfo(uq).read(entity));
}
final Entity read = readEntityWithDeletedCheck(cb);
dbmeta.acceptPrimaryKeyMap(entity, dbmeta.extractPrimaryKeyMap(read));
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractBehaviorReadable method xdoHelpExtractSetInternally.
protected <LOCAL_ENTITY extends Entity, COLUMN, COLLECTION extends Collection<COLUMN>> COLLECTION xdoHelpExtractSetInternally(List<LOCAL_ENTITY> localEntityList, String propertyName, COLLECTION collection) {
assertObjectNotNull("localEntityList", localEntityList);
assertObjectNotNull("propertyName", propertyName);
final ColumnInfo columnInfo = asDBMeta().findColumnInfo(propertyName);
for (LOCAL_ENTITY entity : localEntityList) {
final COLUMN column = columnInfo.read(entity);
if (column != null) {
collection.add(column);
}
}
return collection;
}
use of org.dbflute.dbmeta.info.ColumnInfo in project dbflute-core by dbflute.
the class AbstractBehaviorReadable method assertEntityNotNullAndHasPrimaryKeyValue.
/**
* Assert that the entity has primary-key value. e.g. insert(), update(), delete()
* @param entity The instance of entity to be checked. (NotNull)
*/
protected void assertEntityNotNullAndHasPrimaryKeyValue(Entity entity) {
assertEntityNotNull(entity);
final Set<String> uniqueDrivenPropSet = entity.myuniqueDrivenProperties();
if (uniqueDrivenPropSet.isEmpty()) {
// PK, basically here
if (!entity.hasPrimaryKeyValue()) {
createBhvExThrower().throwEntityPrimaryKeyNotFoundException(entity);
}
} else {
// unique-driven
for (String prop : uniqueDrivenPropSet) {
final ColumnInfo columnInfo = asDBMeta().findColumnInfo(prop);
if (columnInfo != null) {
final Object value = columnInfo.read(entity);
if (value == null) {
createBhvExThrower().throwEntityUniqueKeyNotFoundException(entity);
}
}
}
}
}
Aggregations