use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.
the class HpAbstractSpecification method doColumn.
protected SpecifiedColumn doColumn(String columnName) {
// for extended class
checkSpecifiedThemeColumnStatus(columnName);
if (isSpecifiedColumn(columnName)) {
// returns the same instance as the specified before
return getSpecifiedColumn(columnName);
}
assertColumn(columnName);
callQuery();
if (isRequiredColumnSpecificationEnabled()) {
_alreadySpecifiedRequiredColumn = true;
doSpecifyRequiredColumn();
}
final SqlClause sqlClause = _baseCB.getSqlClause();
final String tableAliasName;
if (_query.isBaseQuery()) {
tableAliasName = sqlClause.getBasePointAliasName();
} else {
final String relationPath = _query.xgetRelationPath();
final int nestLevel = _query.xgetNestLevel();
tableAliasName = sqlClause.resolveJoinAliasName(relationPath, nestLevel);
keepDreamCruiseJourneyLogBookIfNeeds(relationPath, tableAliasName);
reflectDreamCruiseWhereUsedToJoin(relationPath, tableAliasName);
}
final SpecifiedColumn specifiedColumn = createSpecifiedColumn(columnName, tableAliasName);
sqlClause.specifySelectColumn(specifiedColumn);
saveSpecifiedColumn(columnName, specifiedColumn);
return specifiedColumn;
}
use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.
the class ConditionBeanExceptionThrower method throwSpecifyEveryColumnAlreadySpecifiedColumnException.
public void throwSpecifyEveryColumnAlreadySpecifiedColumnException(String tableDbName, Map<String, SpecifiedColumn> specifiedColumnMap) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The SpecifyEveryColumn is specified after SpecifyColumn.");
br.addItem("Advice");
br.addElement("You cannot specify columns with every column.");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" memberBhv.batchUpdate(memberList, colCB -> {");
br.addElement(" colCB.specify().columnMemberName();");
br.addElement(" colCB.specify().everyColumn(); // *No");
br.addElement(" });");
br.addElement(" (o):");
br.addElement(" memberBhv.batchUpdate(memberList, colCB -> {");
br.addElement(" colCB.specify().everyColumn();");
br.addElement(" });");
br.addItem("Base Table");
br.addElement(tableDbName);
if (specifiedColumnMap != null) {
// basically true
br.addItem("Specified Column");
final Collection<SpecifiedColumn> columnList = specifiedColumnMap.values();
for (SpecifiedColumn column : columnList) {
br.addElement(column);
}
}
final String msg = br.buildExceptionMessage();
throw new SpecifyEveryColumnAlreadySpecifiedColumnException(msg);
}
use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.
the class ConditionBeanExceptionThrower method throwSpecifyExceptColumnAlreadySpecifiedColumnException.
public void throwSpecifyExceptColumnAlreadySpecifiedColumnException(String tableDbName, Map<String, SpecifiedColumn> specifiedColumnMap) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The SpecifyExceptColumn is specified after SpecifyColumn.");
br.addItem("Advice");
br.addElement("You cannot specify columns with except columns.");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" ... = memberBhv.selectList(cb -> {");
br.addElement(" cb.specify().columnMemberName(");
br.addElement(" cb.specify().exceptRecordMetaColumn(); // *No");
br.addElement(" });");
br.addElement(" (o):");
br.addElement(" ... = memberBhv.selectList(cb -> {");
br.addElement(" cb.specify().exceptRecordMetaColumn();");
br.addElement(" });");
br.addElement(" (o):");
br.addElement(" ... = memberBhv.selectList(cb -> {");
br.addElement(" cb.specify().columnMemberName()");
br.addElement(" });");
br.addItem("Base Table");
br.addElement(tableDbName);
if (specifiedColumnMap != null) {
// basically true
br.addItem("Specified Column");
final Collection<SpecifiedColumn> columnList = specifiedColumnMap.values();
for (SpecifiedColumn column : columnList) {
br.addElement(column);
}
}
final String msg = br.buildExceptionMessage();
throw new SpecifyExceptColumnAlreadySpecifiedColumnException(msg);
}
use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.
the class ManualOrderOption method resolveBoundValue.
// -----------------------------------------------------
// Resolve Bound
// -------------
protected Object resolveBoundValue(HpManualOrderThemeListHandler handler, Object plainValue, boolean suppressBinding) {
if (plainValue == null) {
return null;
}
if (plainValue instanceof SpecifiedColumn) {
return resolveDreamCruiseExp(plainValue);
}
ClassificationCodeType codeType = null;
if (plainValue instanceof Classification) {
final Classification cls = (Classification) plainValue;
plainValue = handleClassificationOrderValue(cls);
codeType = cls.meta().codeType();
}
final Object boundExp;
if (suppressBinding) {
if (plainValue instanceof String) {
if (canBeLiteralClassificationCodeType(codeType)) {
boundExp = plainValue;
} else {
String notice = "The binding of string value is unsupported on the DBMS.";
throwUnsupportedTypeSpecifiedException(notice, plainValue);
// unreachable
boundExp = null;
}
} else if (plainValue instanceof Number) {
boundExp = buildLiteralNumberExpression(plainValue);
} else if (isAnyLocalDate(plainValue) || plainValue instanceof Date) {
// #date_parade
boundExp = buildLiteralDateExpression(plainValue);
} else {
String notice = "The binding of the type is unsupported on the DBMS.";
throwUnsupportedTypeSpecifiedException(notice, plainValue);
// unreachable
boundExp = null;
}
} else {
boundExp = handler.register(THEME_KEY, plainValue);
}
return boundExp;
}
use of org.dbflute.cbean.dream.SpecifiedColumn in project dbflute-core by dbflute.
the class ManualOrderOption method resolveDreamCruiseExp.
protected Object resolveDreamCruiseExp(Object plainValue) {
final SpecifiedColumn specifiedColumn = (SpecifiedColumn) plainValue;
final String columnExp = specifiedColumn.toColumnRealName().toString();
if (specifiedColumn.hasSpecifyCalculation()) {
specifiedColumn.xinitSpecifyCalculation();
final HpCalcSpecification<ConditionBean> calcSpecification = specifiedColumn.getSpecifyCalculation();
return calcSpecification.buildStatementToSpecifidName(columnExp);
}
return columnExp;
}
Aggregations